读书人

ext2 干gridPanel查询数据时columnM

发布时间: 2012-08-29 08:40:14 作者: rapoo

ext2 做gridPanel查询数据时,columnModel中只要增加编号或者选框 gridPanel就不能够加载数据显示在表格里。
我的情况是这样的,这两天在做 员工记录查询, 通过json来传输数据。 用 gridPanel表格来显示。
以下是我多次测试的问题点:
1,gridPanel的 columnModel中没有添加 Ext.grid.CheckBoxSelectionModel即选框的时候,store能够成功加载数据并显示。
2, columnModel 中设有 RowSelectionModel(即编号),CheckBoxSelectionModel(即选框),员工id以及员工姓名的时候,store能成功加载,gridpanel显示出这几列数据;然而我在coulumnModel中加上员工密码列或者其他列之后,store能够成功加载数据,可是gridpanel死活不能显示数据,控制台还抱一个莫名奇妙的错误。

麻烦各位,帮我找找,我是错在什么细节地方。很郁闷,我都花了两天时间了。求各位了!!!跪求!!

以下是代码,注释了Jsonreader和columnModel中workerName员工姓名之后对应的列后,grid能显示出数据。如果不注释,就不能显示,这是什么原因呢?

JScript code
var store = new Ext.data.Store({            proxy : new Ext.data.HttpProxy({                        method : 'post',                        url : 'worker_selectAll.action'                    }),            reader : new Ext.data.JsonReader({                        totalProperty : 'total',                        root : 'list',                        id : 'workerId',                        fields : [{                                    name : 'workerId',                                    type : 'int'                                }, {                                    name : 'workerName',                                    type : 'String'                                //                                    name : 'workerLogin',//                                    type : 'String'//                                , {//                                    name : 'workerPassword',//                                    type : 'String'//                                }//                                    name : 'brithday',//                                    type : 'String'//                                , {//                                    name : 'workerEmail',//                                    type : 'String'//                                }, {//                                    name : 'workerCompensation',//                                    type : 'String'//                                }, {//                                    name : 'wposition',//                                    type : 'String'//                                }, {//                                    name : 'wfreetiime',//                                    type : 'String'//                                }, {//                                    name : 'wlevel',//                                    type : 'String'                                }]                    })        });var rm = new Ext.grid.RowSelectionModel();var sm = new Ext.grid.CheckboxSelectionModel();var cm = new Ext.grid.ColumnModel([rm, sm, {            header : '员工Id',            dataIndex : 'workerId'        }, {            header : '姓名',            dataIndex : 'workerName'        //            header : '登录名',//            dataindex : 'workerLogin'//        , {//            header : '密码',//            dataindex : 'workerPassword'//        }, //            header : '生日',//            dataindex : 'brithday'//         {//            header : '电子邮件',//            dataindex : 'workerEmail'//        }, {//            header : '基本工资',//            dataindex : 'workerCompensation'//        }, {//            header : '职位',//            dataindex : 'wposition'//        }, {//            header : '假期',//            dataindex : 'wfreetiime'//        }, {//            header : '级别',//            dataindex : 'wlevel'        }]);var grid = new Ext.grid.GridPanel({            width : '100%',            height : 700,            margins : '0 5 5 5',            sm : sm,            cm : cm,            title : '员工列表',            store : store        })store.load();store.on('load', function(_store) {            alert("store.getTotalCount()=" + store.getTotalCount());        });/* * ================ Start page ======================= */// The default start page, also a simple example of a FitLayout.var start = {    id : 'start-panel',    title : '首页',    layout : 'fit',    bodyStyle : 'padding:25px',    contentEl : 'start-div' // pull existing content from the page};/* * ================ 用户查询======================= */var selWorker = {    id : 'selWorker-panel',    title : '用户查询',    layout : 'fit',    defaults : {        bodyStyle : 'padding:15px;',        width : '100%',        height : 900,        frame : true    },    // tbar : _toolbar,    items : grid}; 



[解决办法]
我也遇到类似的问题 求解
[解决办法]
看着括号不对应 。

读书人网 >Ajax

热点推荐