How to retrieve JSON Data Array from ExtJS Store

后端 未结 15 2049
忘掉有多难
忘掉有多难 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:30

    If you want to get the data exactly like what you get by Writer (for example ignoring fields with persist:false config), use the following code (Note: I tested it in Ext 5.1)

      var arr = [];   
    
        this.store.each(function (record) {
            arr.push(this.store.getProxy().getWriter().getRecordData(record))
        });  
    
    0 讨论(0)
  • 2020-12-04 17:32

    Try this one line code it worked for me like charm:

    var data = (store.getData().getSource() || store.getData()).getRange();
    
    0 讨论(0)
  • 2020-12-04 17:33

    Here is another simple clean way:

    var jsonArr = [];
    grid.getStore().each( function (model) {
        jsonArr.push(model.data);
    });
    
    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题