Search code examples
javascriptextjsextjs4jsonstore

How to get the list of fields from unknown JsonStore objects?


Writing a function to generate and push some random data inside of the unknown passed data store object. I know I can iterate over records and then iterate over fields, but I need to have the list of fields before starting to push random generated record at top of other records (and then remove the last item to simulate a real-time chart).

Any enlightening idea besides of I am a n00b on ExtJS?


Solution

  • UPDATE: You are using Extjs 4. Then try this:

    var store = new Ext.data.Store({url:'testUrl', fields:[{name:'value'}]});
    
    //The array of fields(Ext.data.Field)
    var fields = store.proxy.reader.getFields();