How to retrieve JSON Data Array from ExtJS Store

后端 未结 15 2132
忘掉有多难
忘掉有多难 2020-12-04 17:04

Is there a method allowing me to return my stored data in an ExtJS Grid Panel exactly the way I loaded it using:

var data = [\"value1\", \"value2\"]
Store.lo         


        
15条回答
  •  醉梦人生
    2020-12-04 17:16

    In my case I wanted a javascript jagged array e.g. [["row1Cell1", "row1cell2"],["row2Cell1", "row2cell2"]] based on the contents of the Ext grid store.

    The javascript as below will create such an array, dropping the id key in the object which I didn't need.

    var tableDataArray = [];
    Ext.ComponentQuery.query('[name="table1"]')[0].store.each(function(record){
        var thisRecordArray = [];
        for (var key in record.data) {
            if (key != 'id') {
                thisRecordArray.push(record.data[key]);
            }
        }
        tableDataArray.push(thisRecordArray);
    });
    

提交回复
热议问题