1. #1
    Sencha User
    Join Date
    Jan 2012
    Posts
    11
    Vote Rating
    1
    rufwork is on a distinguished road

      0  

    Question Iterate Record fields without field/column names

    Iterate Record fields without field/column names


    Is there a way to iterate an individual Ext.data.Record without knowing the column names in advance?

    For instance:

    Code:
    var jsonStoreTest = new Ext.data.Store({
        url: './json/gridValues.json',
        reader: jsonReaderTest
    });
    
    // Now iterate the data once it's returned, remembering that we're
    // dealing with an asynchronous paradigm here.
    jsonStoreTest.on("load", function(s,rs) {
        console.log("and we're back");
        this.each(function(record) {
            console.log('record data from callback: ' + record.data.FIELD_NAME);  // works
            //var strFieldName = record.???;
            //console.log('record data from callback: ' + record.get(strFieldName));
        });
    });
    jsonStoreTest.load();
    Is there some way I can insert something for ??? that takes an int to grab, say, the first field's data? In other words, I half-way expected getAt to be overloaded with a getAt(int) version with the column/field ordinal. Is there an logical equivalent?

    (Note that I realize if you properly set up a grid to take in the Store, you'll be able to access the column names with something like...
    Code:
    var columnName = grid.getColumnModel().getDataIndex(columnIndex);
    ... but I'm looking for an analog in the Record object.)

    Thanks!

  2. #2
    Sencha User
    Join Date
    Jan 2012
    Posts
    11
    Vote Rating
    1
    rufwork is on a distinguished road

      0  

    Default


    Found it under getColumnData in the GridView extension of Observable.

    Code:
    this.each(function(record) {        
            var strFieldName = this.fields.get(3).name;
            console.log('record data from callback: ' + record.get(strFieldName));
    //        console.log('record data from callback: ' + record.data.FIELD_NAME);
    });

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar