planetfederal / gxp

High level components for GeoExt based applications.
http://boundlessgeo.com/
Other
84 stars 97 forks source link

gxp_featuregrid causing error #246

Closed staalburger closed 9 years ago

staalburger commented 9 years ago

I am new to gpx. I am following the documentation on creating a map app. Upon requiring and including 'gxp_featuregrid' in my project and setting up the portalConfig and tools I get the following error: feature_grid_error

What may cause this error as I am unable to find the cause of this?

Link to the documentation: http://suite.opengeo.org/opengeo-docs/webapps/gxp/editor/featuregrid.html

bartvde commented 9 years ago

did you add the corresponding feature manager as well? Can you provide your full config for gxp.Viewer?

staalburger commented 9 years ago

This is a list of my dependencies: /**

Here is the config for the Viewer: gxp.Viewer({ portalConfig: { layout: "border", region: "center",

    // by configuring items here, we don't need to configure portalItems
    // and save a wrapping container
    items: [{
        id: "centerpanel",
        xtype: "panel",
        layout: "fit",
        region: "center",
        border: false,
        items: ["mymap"]
    }, {
        id: "westpanel",
        xtype: "container",
        layout: "fit",
        region: "west",
        width: 200
    },{
        id: "south",
        xtype: "container",
        layout: "fit",
        region: "south",
        border: false,
        height: 200
    }],
    bbar: {id: "mybbar"}
},
bartvde commented 9 years ago

so where are your tools defined?

staalburger commented 9 years ago

Here is my whole app.js: /**

var app = new gxp.Viewer({ portalConfig: { layout: "border", region: "center",

    // by configuring items here, we don't need to configure portalItems
    // and save a wrapping container
    items: [{
        id: "centerpanel",
        xtype: "panel",
        layout: "fit",
        region: "center",
        border: false,
        items: ["mymap"]
    }, {
        id: "westpanel",
        xtype: "container",
        layout: "fit",
        region: "west",
        width: 200
    },{
        id: "south",
        xtype: "container",
        layout: "fit",
        region: "south",
        border: false,
        height: 200
    }],
    bbar: {id: "mybbar"}
},

// configuration of all tool plugins for this application
tools: [{
    ptype: "gxp_layertree",
    outputConfig: {
        id: "tree",
        border: true,
        tbar: [] // we will add buttons to "tree.bbar" later
    },
    outputTarget: "westpanel"
}, {
    ptype: "gxp_addlayers",
    actionTarget: "tree.tbar"
}, {
    ptype: "gxp_removelayer",
    actionTarget: ["tree.tbar", "tree.contextMenu"]
}, {
    ptype: "gxp_zoomtoextent",
    actionTarget: "map.tbar"
}, {
    ptype: "gxp_zoom",
    actionTarget: "map.tbar"
}, {
    ptype: "gxp_navigationhistory",
    actionTarget: "map.tbar"
}, {
    ptype: "gxp_featuregrid",
    autoLoadFeature: true,
    featureManager: "states_manager",
    outputConfig: {
        loadMask: true
    },
    outputTarget: "south"
}],

// layer sources
sources: {
    local: {
        ptype: "gxp_wmscsource",
        url: "/geoserver/wms",
        version: "1.1.1"
    },
    osm: {
        ptype: "gxp_osmsource"
    }
},

// map and layers
map: {
    id: "mymap", // id needed to reference map in portalConfig above
    title: "Map",
    projection: "EPSG:900913",
    center: [-10764594.758211, 4523072.3184791],
    zoom: 3,
    layers: [{
        source: "osm",
        name: "mapnik",
        group: "background"
    }, {
        source: "local",
        name: "usa:states",
        selected: true
    }],
    items: [{
        xtype: "gx_zoomslider",
        vertical: true,
        height: 100
    }]
}

});

bartvde commented 9 years ago

you're missing a feature manager, you need that for the feature grid

see: http://suite.opengeo.org/opengeo-docs/webapps/gxp/editor/featuremanager.html

staalburger commented 9 years ago

Great, that sorted it. I thought merely listing FeatureManager as a dependency was enough. Thank you for helping me so quickly.