Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am trying to create a functionality that creates array data for any layer that user selects. Now I am able to get all the data in the feature layer that the user selects but I am having some trouble with the ArrayReader to which I need to assign the field names of the feature data.

So this is field collection loop,

for (var prop in e.features[0].attributes) { attrfields.push(prop); }

As of now I am hard coding the ArrayReader like this,

var myReader = new Ext.data.ArrayReader({},[
                    {name: 'family'},
                    {name: 'species'}
                ]);

I need to replace,

[{name: 'family'}, {name: 'species'}]

with the attrfields, which looks like this,

[Object {"Family"}, Object {"Species"}]

Now am confused as to how I should create attrfields to replace it in the ArrayReader? Any suggesstions?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

This was the solution, http://www.sencha.com/forum/showthread.php?245126-Dynamically-assigning-titles-to-Ext.grid-columns

I needed to create the columns fields separately and then add the attrfields to the ArrayReader.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.