[Users] Synchronized two GridPanel with selectFeature

François Boussuges f.boussuges at gmail.com
Wed Jun 2 15:10:22 CEST 2010


I have find one thing, when I use this script I can select the first 
rows of my gridpanel1 when I click on an row of the gridPanel2:
 
gridPanel2.on('rowclick', function(grid, rowIndex, e) {
              var rec = gridPanel2.getStore().getAt(rowIndex);
              var get= rec.get("IDENTIFIANT_SITE");
                  
                     Ext.MessageBox.alert(get);
                     gridPanel1.getSelectionModel().selectRow(0);
                   
              });
The var get is the ID_SITE attributes of the row of my gridPanel2.
Have you an ideas to make à selectRow() with the var get?

François Boussuges a écrit :
> I try this but It's not work.
> I don't know the method to select a row in a grid panel, my ideas is
> 'when row1 of features 1 is selected take the ID of row1 and select 
> the correspondant row in the grid2.
>
> An other ideas?
>
>
> Charles Galpin a écrit :
>> Hi François
>>
>> I did this with a second grid having another WFS layer and a filter 
>> but I am sure the same principles apply to your xml.
>>
>>
>> On the definition of the layer that is bound to the gridpanel2 (i'll 
>> call it gridpanel2_layer), use a filter like this which is initially 
>> set to match nothing.
>>
>> var gridpanel2 _layer = new OpenLayers.Layer.Vector("gridpanel2 
>> _layer", {
>> ...
>> filter: new OpenLayers.Filter.Comparison({
>>                     type: OpenLayers.Filter.Comparison.EQUAL_TO,
>>                     property: "SITE_ID",
>>                     value: ""
>>                 })
>>>> });
>>
>> Then you can add this event to gridpanel1
>>
>> gridpanel1.getSelectionModel().on('rowselect', function(sm, rowIdx, r) {
>>                 var feature = r.data.feature;
>>                 gridpanel2 _layer.filter = new 
>> OpenLayers.Filter.Comparison({
>>                     type: OpenLayers.Filter.Comparison.EQUAL_TO,
>>                     property: "SITE_ID",
>>                     value: r.data. SITE_ID
>>                 });
>>                 gridpanel2 _layer.refresh();
>>             });
>>
>> hth
>> charles
>>
>> On Jun 2, 2010, at 4:23 AM, François Boussuges wrote:
>>
>>  
>>> The Features store is not the solution:
>>>
>>> -I have a WFS layer with a features store and a gridPanel, all it's 
>>> good. My features have an attributes ID_SITE.
>>>
>>> -I make Ajax request for load other data in a store and a second 
>>> gridpanel. I want to link this data with my layer (or gridpanel), I 
>>> can have more several rows for one features of the layers.
>>> My ideas is: when I click on my feature (on the map) I select the 
>>> row of the feature in the gridpanel of the layer (it's ok) and I 
>>> select the rows with the same ID_SITE in the second Panel.
>>>
>>> I think I can make an event (layer.event.on) with a function.
>>> Actually I can select the ID_SITE of my selected features but I 
>>> don't know what do I do to select the rows with the same ID_SITE in 
>>> my second gridpanel (gridpanel2.selectRows?).
>>>
>>>
>>> Pierre Giraud a écrit :
>>>    
>>>> Actually, you don't really need to load the data twice. The features
>>>> in your layer should help you fill the grid.
>>>> Consider using a FeatureStore bound to your layer.
>>>> http://geoext.org/lib/GeoExt/data/FeatureStore.html
>>>>
>>>> var store = new Ext.data.FeatureStore({
>>>>    layer: yourLayer,
>>>>    fields: [{
>>>>        ...
>>>>    }]
>>>> });
>>>>
>>>> Then use this store for your grid panel.
>>>>
>>>> Regards,
>>>> Pierre
>>>>
>>>>
>>>> 2010/6/2 François Boussuges <f.boussuges at gmail.com>:
>>>>
>>>>      
>>>>> Hello,
>>>>> I have a question about the feature selection and the grid panel.
>>>>>
>>>>> I have a WFS layers with a grid panel, in this layer I have an 
>>>>> ID_SITE
>>>>> attribute.
>>>>> In a second grid panel I load XML files (with Ajax), this files 
>>>>> contains
>>>>> the ID_SITE attribute.
>>>>>
>>>>> When I select à features of my WFS layer (on the map or the 
>>>>> gridpanel)
>>>>> what do I do to select automaticaly rows with the same ID_SITE in the
>>>>> second grid panel?
>>>>>
>>>>> Thank youvery much!
>>>>>
>>>>> François
>>>>> _______________________________________________
>>>>> 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
>>>     
>>
>>
>>   
>
>



More information about the Users mailing list