GeoExt

Table Of Contents

Previous topic

GeoExt.form.SearchAction

Next topic

GeoExt.tree.BaseLayerContainer

GeoExt.grid.FeatureSelectionModel

Extends
class GeoExt.grid.FeatureSelectionModel
A row selection model which enables automatic selection of features in the map when rows are selected in the grid and vice-versa.

Example Use

Sample code to create a feature grid with a feature selection model:

 var gridPanel = new Ext.grid.GridPanel({
    title: "Feature Grid",
    region: "east",
    store: store,
    width: 320,
    columns: [{
        header: "Name",
        width: 200,
        dataIndex: "name"
    }, {
        header: "Elevation",
        width: 100,
        dataIndex: "elevation"
    }],
    sm: new GeoExt.grid.FeatureSelectionModel()
});

Config Options

Configuration properties in addition to those listed for Ext.grid.RowSelectionModel.

autoActivateControl
Boolean If true the select feature control is activated and deactivated when binding and unbinding. Defaults to true.
layer
OpenLayers.Layer.Vector The vector layer used for the creation of the select feature control, it must already be added to the map. If not provided, the layer bound to the grid’s store, if any, will be used.
layerFromStore
Boolean If true, and if the constructor is passed neither a layer nor a select feature control, a select feature control is created using the layer found in the grid’s store. Set it to false if you want to manually bind the selection model to a layer. Defaults to true.
selectControl
OpenLayers.Control.SelectFeature A select feature control. If not provided one will be created. If provided any “layer” config option will be ignored, and its “multiple” option will be used to configure the selectionModel. If an Object is provided here, it will be passed as config to the SelectFeature constructor, and the “layer” config option will be used for the layer.

Public Methods

Public methods in addition to those listed for Ext.grid.RowSelectionModel.

FeatureSelectionModel.bind()
Parameters:
  • objOpenLayers.Layer.Vector or OpenLayers.Control.SelectFeature The object this selection model should be bound to, either a vector layer or a select feature control.
  • optionsObject An object with a “controlConfig” property referencing the configuration object to pass to the OpenLayers.Control.SelectFeature constructor.
Returns:

OpenLayers.Control.SelectFeature The select feature control this selection model uses.

Bind the selection model to a layer or a SelectFeature control.

FeatureSelectionModel.unbind()
Returns:OpenLayers.Control.SelectFeature The select feature control this selection model used.

Unbind the selection model from the layer or SelectFeature control.