Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/extjs/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在extjs中获取json属性_Extjs - Fatal编程技术网

如何在extjs中获取json属性

如何在extjs中获取json属性,extjs,Extjs,我有: {“文件”:[{“名称”:“1”,“大小”:“329”},{“名称”:“Spring”,“大小”:“153”},],“路径”:“C:\Programs”} 并使用jsonReader存储 var fileListStore = new Ext.data.Store({ proxy: new Ext.data.HttpProxy(connection), baseParams: { path: '', action: '' },

我有:

{“文件”:[{“名称”:“1”,“大小”:“329”},{“名称”:“Spring”,“大小”:“153”},],“路径”:“C:\Programs”}

并使用jsonReader存储

var fileListStore = new Ext.data.Store({
    proxy: new Ext.data.HttpProxy(connection),
    baseParams: {
        path: '',
        action: ''
    },
    storeId: 'fileListStore',
    autoLoad: true,
    remoteSort: true,
    reader: new Ext.data.JsonReader({
    root: 'files',
    fields: [
        'name',
        'size'
        ]
    })
});
如何更改jsonReader以获取json属性“path”? 如何打印呢?

如果“打印”的意思是显示每条记录的路径,那么最好在生成JSON数据时将其复制到每条记录中,并处理网格列呈现器中的任何混乱细节

如果仍然必须将路径作为其自己的根级别属性,则可以为HttpProxy的加载事件添加侦听器,并使用它读取JsonReader的jsonData属性:

new Ext.data.HttpProxy({
    listeners: {
        load: function( proxy, req ) {
            window.alert(req.reader.jsonData.path);
        }
    }
});

试着精确一点你想要达到的目标