filled ExtJs columns json

filled ExtJs columns json

本文关键字:json columns ExtJs filled      更新时间:2023-09-26

我喜欢列。并且有一个处理json数据的jsp。im在我的js中喷射这个json并执行Ext.data.JsonStore,但它没有进入列。

存储

store = new Ext.data.JsonStore({
url: url_servlet+'Kadastr.jsp',
    fields: [
        {name: 'indoor', type: 'bool'},
        {name: 'kad_id', type: 'integer'},
        {name: 'kad_name',type: 'string'}
    ]
});
store.load();

var cm = new Ext.grid.ColumnModel({
    columns: [{
        xtype: 'checkcolumn',
        header: '',
        dataIndex: 'indoor',
        width: 50
    }, {
        header: 'id',
        dataIndex: 'kad_id',
        width: 70
    },{
        id: 'kad_name',
        header: 'Участок',
        dataIndex: 'common',
        width: 130,
        }]
})

格栅板

var kad_tab = new Ext.grid.GridPanel({
    store: store,
    cm: cm,
    id: 'kad_greed',
    title:'Список Участков',
    autoScroll: true,

java代码

            JSONObject resultJson = new JSONObject();
    resultJson.put("indoor",new Boolean(false));
    resultJson.put("kad_name",fileName);
    resultJson.put("kad_id",new Integer(fileId));
            out.println(resultJson.toString());

有艾迪亚斯吗?我能补充什么?

存储读取器需要一个项目数组,因为我看到您只发送了一条记录。因此,您应该发送一个数组和一个根对象,而不是:{"indoor":false,"kad_name":"filename"..}。类似于:

{"values":[{"indoor":false,"kad_name":"filename"..}]},然后将根"值"添加到jsonreader中。默认根目录为",因此您可以使用默认空白发送它。