Hello all

I am following this example http://api.geoext.org/1.0/examples/feature-grid.html
but I am installing for more than 3 layers my code as bellow
       
     var data1="HETHONG";
var data2="FTNHIEN";
var data3="data/form.json";

function combo_check(check)
{
switch(check)
{
case "basin":
   data1="HETHONG";
   data2="FTNHIEN";
   data3="data/form.json";
  break;
case "rainfall":
data1="TEN_TRAM";
    data2="CD_TRAM";
data3="data/station1.json";
  break;
  case "tram1":
data1="TEN_TRAM";
    data2="CD_TRAM";
data3="data/rain_stations.json";
  break;
};

   store1 = new GeoExt.data.FeatureStore({
        layer: vecLayer,
        fields: [
            {name: data1, type: 'string'},
            {name: data2, type: 'float'}
        ],
        proxy: new GeoExt.data.ProtocolProxy({
            protocol: new OpenLayers.Protocol.HTTP({
                //url: "data/form.json",
url: data3,
                format: new OpenLayers.Format.GeoJSON()
            })
        }),
        autoLoad: true
    });

    gridPanel = new Ext.grid.GridPanel({
        title: "Feature Grid",
        region: "east",
        store: store1,
        width: 320,
        columns: [{
            header: "Name",
            width: 200,
            dataIndex: data1
        }, {
            header: "Value",
            width: 100,
            dataIndex: data2
        }],
        sm: new GeoExt.grid.FeatureSelectionModel() 
    });
 var datastore = new Ext.data.SimpleStore({
    fields: ['alpha2code','name'],
    data: [["basin","topp:basin"],["rainfall","rainfall 
station"],["tram1","Stations1"]]
  });
var CBSelector = new Ext.form.ComboBox({
        id: 'countryCmb',
store: datastore,
fieldLabel: 'basin',
displayField:'name',
valueField: 'alpha2code',
        typeAhead: true,
selectOnFocus: true,
        mode: 'local',
        forceSelection: true,
        triggerAction: 'all',
valueNotFoundText: 'Loading...',
 typeAhead: true,
editable: false,
        value: 'basin'
    });

 CBSelector.on('select', function(combo, record, index){
combo_check(combo.value)
}, 
this
);

I have checked variables received correctly value for change json files and 
fields name but the Map and grid have not refreshed yet, could you please tell 
me how to do or there are some another function need to require in this case 

Many Thanks

Quang


      
_______________________________________________
Users mailing list
[email protected]
http://www.geoext.org/cgi-bin/mailman/listinfo/users

Reply via email to