Setting up a feature managerΒΆ

Editing with the SDK always starts with setting up a “feature manager”. In the API documentation, find the gxp.plugins.FeatureManager tool. This provides the “feature manager” functionality. The ptype for gxp.plugins.FeatureManager is gxp_featuremanager. Open up app.js in the application directory. Add plugins/FeatureManager.js to the list of dependencies at the top of the file.

* @require plugins/FeatureManager.js

Then search for the tools section and add the following:

{
    ptype: "gxp_featuremanager",
    id: "states_manager",
    paging: false,
    layer: {
        source: "local",
        name: "usa:states"
    }
}

In the above case the feature manager is configured with a fixed layer. However, it’s also possible to have the feature manager listen to the active (selected) layer in the layer tree. In the latter case, the feature manager would be configured without a layer and with autoSetLayer set to true:

{
    ptype: "gxp_featuremanager",
    id: "states_manager",
    paging: false,
    autoSetLayer: true
}

Reloading the application will not show any visible change. This is because the feature manager is an invisble tool that can be used by other tools, such as the FeatureEditor. However, if we would open up Firebug we would see two additional requests: a SLD WMS DescribeLayer request, and a WFS DescribeFeatureType request for the configured layer.