[Users] Two different stores for the same GridPanel
gbrun
gbrun at myopera.com
Fri Jun 24 15:17:09 CEST 2011
Thanks for the link, it was a good idea ! I did many tests, but unlikely,
it didn't work... In firebug, I got this error : "b.join is not a
function" (in ext-all.js). I'm working with Ext 3.3.1.
Here is my new code:
var store_WMS = new GeoExt.data.WMSCapabilitiesStore({
url:
"/geoserver/ows?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities&namespace=parc",
protocolOptions: {version: "1.1.0"},
autoLoad: true
});
var store_WFS = new GeoExt.data.WFSCapabilitiesStore({
url:
"/geoserver/ows?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetCapabilities&namespace=parc",
protocolOptions: {version: "1.1.0"},
autoLoad: true,
listeners: {
load: function(store) {
store_WMS.add({records: store.getRange()},{add: true});
}
}
});
var grid = new Ext.grid.GridPanel({
title: "Couches disponibles",
anchor: '100% 50%',
store: store_WMS,
collapsible: true,
collapsed: false,
........
I changed the suggested code in your link : the method "addRecords()"
doesn't exist anymore (referring to ExtJS 3.3.1 and 4.0.0 API
documentation). Now, it's just the method "add()".
But there is always this error with the join "non-function"! A little
improvement: the WMS layers are well loaded in the grid. Only the WFS
layers aren't displayed inside it!
Another idea?
Geoffrey
On Fri, 24 Jun 2011 13:34:49 +0200, Charles Galpin <cgalpin at lhsw.com>
wrote:
> Hi Geoffrey
>
> I have not tried this myself, but I'm assuming adding the contents of
> one store to the other will work like you can do with a plain Ext store
> -
>
> http://www.sencha.com/learn/Ext_FAQ_Grid#Load_data_to_a_grid_from_two_different_server_calls.2Fstores
>
> hth
> charles
>
> On Jun 24, 2011, at 5:20 AM, gbrun wrote:
>
>> Hi everybody!
>>
>> I'm trying to populate an GridPanel with a WMSCapabilitiesStore and a
>> WFSCapabilitiesStore. My problem is that I don't know how to specify two
>> different stores for the same grid. It works when I work with two
>> separate
>> grids, but not with only one grid.
>>
>> Here is a sample of my current code:
>>
>> //WMS definition catalog
>> var store_WMS = new GeoExt.data.WMSCapabilitiesStore({
>> url:
>> "/geoserver/ows?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities&namespace=parc",
>> protocolOptions: {version: "1.1.0"},
>> autoLoad: true
>> });
>>
>> //WFS definition catalog
>> var store_WFS = new GeoExt.data.WFSCapabilitiesStore({
>> url:
>> "/geoserver/ows?SERVICE=WFS&VERSION=1.0.0&REQUEST=GetCapabilities&namespace=parc",
>> protocolOptions: {version: "1.1.0"},
>> autoLoad: true
>> });
>>
>> //Grid definition for WMS
>> var grid_WMS = new Ext.grid.GridPanel({
>> title: "Couches disponibles",
>> anchor: '100% 50%',
>> store: store_WMS,
>> collapsible: true,
>> collapsed: false,
>> titleCollapse: true,
>> autoScroll: true,
>> split: true,
>> columns: [
>> {header: "Name", dataIndex: "name", sortable: true},
>> {header: "Title", dataIndex: "title", sortable:
>> true}
>> ],
>> bbar: ['->',{
>> text: "Add to map",
>> handler: function() {
>> grid_WMS.getSelectionModel().each(function(record) {
>> var clone = record.clone();
>> clone.get("layer").mergeNewParams({
>> format: "image/png",
>> transparent: true
>> });
>> mapPanel.layers.add(clone);
>> });
>> }
>> }]
>> });
>>
>>
>> Does everyone have an idea?
>>
>> Geoffrey
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>
> _______________________________________________
> Users mailing list
> Users at geoext.org
> http://www.geoext.org/cgi-bin/mailman/listinfo/users
--
Using Opera's revolutionary email client: http://www.opera.com/mail/
More information about the Users
mailing list