How to configure ExtJS 4 Store (proxy and reader) to read metadata

前端 未结 3 934
攒了一身酷
攒了一身酷 2021-02-03 13:25

My question is how to get metadata besides totalRecords, in my case it is version, code, searchquery (please look at json).

{
\"result\": {
    \"version\":\"1\         


        
3条回答
  •  春和景丽
    2021-02-03 14:00

    Here is solution for my problem. I am handling afterRequest event in the Proxy class where I can get response data, parse it and save metadata. This is proxy part of the TestStore class:

    So here is proxy part from the TestStore class:

    proxy: {
            type: "ajax",
            url: "/users.json",  
            reader: {
                type    : 'json',
                root    : 'gip.account',
                totalProperty: "gip.totalRecords",
                searchquery: "searchquery"
            },
            afterRequest: function(req, res) {
                console.log("Ahoy!", req.operation.response);    
            }
        }
    

提交回复
热议问题