[Users] WFS feature attributes do not show up in gridPanel

Frans Knibbe frans at geodan.nl
Wed Jun 9 12:57:37 CEST 2010


Hello Bart,

Yes, the fields are there in the example. Only I could not figure out 
their purpose so I left them out. But now I tried again and I got it to 
work. So thanks a lot! I think that in earlier attempts I did not 
reference the fields correctly. I have now found out that I should not 
use the feature.attribute.field notation, but just use the name of the 
field ( or GML element).

So my working configuration has become:

     var store = new GeoExt.data.FeatureStore(
         {
             layer: wfs_no_gn
             ,fields: [
                 {name: "text", type: "string"}
                 ,{name: "language", type: "string"}
                 ,{name: "nameStatus", type: "string"}
                 ,{name: "nativeness", type: "string"}
             ],
         }
     );
     var gridPanel = new Ext.grid.GridPanel(
         {
             title: "Features"
             ,sm: new GeoExt.grid.FeatureSelectionModel()
             ,cm: new Ext.grid.ColumnModel(
                 {
                     defaults: {
                         sortable: true
                     }
                     ,columns: [
                         {header: "ID", dataIndex: "fid"}
                         ,{header: "Name", dataIndex: "text"}
                         ,{header: "Language", dataIndex: "language"}
                         ,{header: "Status", dataIndex: "nameStatus"}
                         ,{header: "Nativeness", dataIndex: "nativeness"}
                     ]
                 }
             )
         }
     );

Thanks again,

Frans


On 2010-06-08 16:21, Bart van den Eijnden (OSGIS) wrote:
> Frans,
>
> I think you need to specify fields in the store definition.
>
> GisArts.storeFields = {};
> GisArts.storeFields['adres_zoeken'] =
> [
>      'num_woonplaats',
>      'num_huisnummer',
>      'huisnummers',
>      'num_openbare_ruimte',
>      'num_huisletter',
>      'num_postcode'
> ];
>
>      {xtype: 'grid', autoWidth: true, autoHeight: true, title: 'Adres',
> autoScroll: true, id: 'grid_Adres_zoeken',
>          store: new GeoExt.data.FeatureStore({
>              features: [],
>              fields: GisArts.storeFields['Adres_zoeken']
>          }), stripeRows: true,
>          colModel: GisArts.colModel['Adres_zoeken']
>      }
>
> Best regards,
> Bart
>
>    
>> Hello everybody,
>>
>> Like some others, I am trying to recreate the 'WFS features in a
>> gridPanel' example that is described at
>> http://workshops.opengeo.org/geoext/wfs/index.html#geoext-wfs. It seems
>> I've almost got it working. The grid panel shows the right number of
>> records and the FID of each record. Also the map and the grid panel are
>> coupled; when I select a feature in one it is selected in the other. But
>> I can't get the ofeature attributes (other than FID) to display in the
>> gridPanel. Here is my store FatureStore and GridPanel definitions:
>>
>>       var store = new GeoExt.data.FeatureStore(
>>           {
>>               layer: wfs_no_gn
>>           }
>>       );
>>       var gridPanel = new Ext.grid.GridPanel(
>>           {
>>               title: "Features"
>>               ,height: 140
>>               ,region: "south"
>>               ,viewConfig: {forceFit: true}
>>               ,collapsible: true
>>               ,collapseMode: "mini"
>>               ,store: store
>>               ,sm: new GeoExt.grid.FeatureSelectionModel()
>>               ,cm: new Ext.grid.ColumnModel(
>>                   {
>>                       defaults: {
>>                           sortable: true
>>                       }
>>                       ,columns: [
>>                           {header: "ID", dataIndex: "fid"}
>>                           ,{header: "Name", dataIndex:
>> "feature.attributes.text"}
>>                           ,{header: "Language", dataIndex:
>> "feature.attributes.language"}
>>                           ,{header: "Status", dataIndex:
>> "feature.attributes.nameStatus"}
>>                           ,{header: "Nativeness", dataIndex:
>> "feature.attributes.nativeness"}
>>                       ]
>>                   }
>>               )
>>           }
>>       );
>>
>> It seems I am missing an important bit of insight. Should I change
>> something in the data store? Or am I using a wrong dataIndex? I hope
>> someone can point me in the right direction.
>>
>> Thanks in advance,
>> Frans
>>
>>
>>
>> _______________________________________________
>> Users mailing list
>> Users at geoext.org
>> http://www.geoext.org/cgi-bin/mailman/listinfo/users
>>
>>      
>
>    





More information about the Users mailing list