Am developing an application using GeoExt/OpenLayers and Geoeserver and am using more that ten(10) layers.I wanted to add a querying functionality on my application.I have done for one layer and is working really fine.
Code
var secStore = Ext.create('GeoExt.data.FeatureStore', { layer: secschools, fields: [ {name: 'Name_of_Sc', type: 'string'}, {name: 'Girls_Boys', type: 'string'}, {name: 'School_Spo', type: 'string'}, {name: 'Day_or_Boa', type: 'string'}, ] }); secStore.load(); var sm = Ext.create('GeoExt.selection.FeatureModel', { autoPanMapOnSelection: true, mode: 'MULTI' }); var secGrid = Ext.create('Ext.grid.GridPanel',{ store: secStore, autoScroll:true, layout:'fit', columns: [{header: "Name", flex:0.4, dataIndex: "Name_of_Sc"}, {header: "Sponsor", flex:0.2, dataIndex: "School_Spo"}, {header: "Girls/Boys", flex:0.2, dataIndex: "Girls_Boys"}, {header: "Day/Boarding", flex:0.2, dataIndex: "Day_or_Boa"}, ], tbar:[{ xtype: 'textfield', width:100, margin: 2, enableKeyEvents: true, listeners: { keyup: function() { var store = this.up('grid').store; store.clearFilter(); if (this.value) { store.filter({ property : 'Name_of_Sc', value : this.value, anyMatch : true, caseSensitive : false }); } }, buffer: 500 } } ], selModel:sm, stripeRows: true, columnLines:true, selType: 'featuremodel', }); The secschools is a WFS layer added on my map.As you can see the grid displays the records form the secschools layer and can be filtered using the textfield. The issue is, I will have to repeat this code as many times as the layers I want queried.Is there anyone with an idea on how I can handle such a querying functionality(to search e.g. 10 layers) in my app without doing as above? Please help...Thanks
أكثر...
Code
var secStore = Ext.create('GeoExt.data.FeatureStore', { layer: secschools, fields: [ {name: 'Name_of_Sc', type: 'string'}, {name: 'Girls_Boys', type: 'string'}, {name: 'School_Spo', type: 'string'}, {name: 'Day_or_Boa', type: 'string'}, ] }); secStore.load(); var sm = Ext.create('GeoExt.selection.FeatureModel', { autoPanMapOnSelection: true, mode: 'MULTI' }); var secGrid = Ext.create('Ext.grid.GridPanel',{ store: secStore, autoScroll:true, layout:'fit', columns: [{header: "Name", flex:0.4, dataIndex: "Name_of_Sc"}, {header: "Sponsor", flex:0.2, dataIndex: "School_Spo"}, {header: "Girls/Boys", flex:0.2, dataIndex: "Girls_Boys"}, {header: "Day/Boarding", flex:0.2, dataIndex: "Day_or_Boa"}, ], tbar:[{ xtype: 'textfield', width:100, margin: 2, enableKeyEvents: true, listeners: { keyup: function() { var store = this.up('grid').store; store.clearFilter(); if (this.value) { store.filter({ property : 'Name_of_Sc', value : this.value, anyMatch : true, caseSensitive : false }); } }, buffer: 500 } } ], selModel:sm, stripeRows: true, columnLines:true, selType: 'featuremodel', }); The secschools is a WFS layer added on my map.As you can see the grid displays the records form the secschools layer and can be filtered using the textfield. The issue is, I will have to repeat this code as many times as the layers I want queried.Is there anyone with an idea on how I can handle such a querying functionality(to search e.g. 10 layers) in my app without doing as above? Please help...Thanks
أكثر...