当前位置: 代码迷 >> ASP.NET >> Ext Js 4 为什么一直出现 grid.getSelectionModel()没有定义。该如何解决
  详细解决方案

Ext Js 4 为什么一直出现 grid.getSelectionModel()没有定义。该如何解决

热度:6888   发布时间:2013-02-25 00:00:00.0
Ext Js 4 为什么一直出现 grid.getSelectionModel()没有定义。
JScript code
var selModel = Ext.create('Ext.selection.CheckboxModel');        Ext.create('Ext.grid.Panel', {            title: '員工建檔',            store: employeeStore,            selModel: selModel,            columnLines: true,            columns: [                Ext.create('Ext.grid.RowNumberer'),              { header: '員工編號', dataIndex: 'EMPNO', width: 80 },              { header: '姓名', dataIndex: 'FULLNAME', width: 120 },              { header: '地址', dataIndex: 'ADDRESS', flex: 1 },              { header: '年齡', dataIndex: 'AGE', width: 60 },              { header: '薪水', dataIndex: 'SALARY' },              { header: 'Email', dataIndex: 'EMAIL', renderer: function (value) { return Ext.String.format('<a href="mailto:{0}">{1}</a>', value, value); } },              { header: '部門編號', dataIndex: 'DEPTNO', width: 60, renderer: function (value) {                  return Ext.String.format('<a href="/HumanResource/Department/{0}">{1}</a>', value, value);              }              }      ],            dockedItems: [            {                dock: 'top',                xtype: 'toolbar',                items: [{                    itemId: 'Button',                    text: '刪除',                    tooltip: '刪除用戶資料',                    iconCls: 'delete',                    handler: function () {                        var record = grid.getSelectionModel().getSelection();                        if (record.length == 0) {                            Ext.MessageBox.show({                                title: "提示",                                msg: "请先选择您要操作的行!"                                //icon: Ext.MessageBox.INFO                             })                            return;                        } else {                            var ids = "";                            for (var i = 0; i < record.length; i++) {                                ids += record[i].get("id")                                if (i < record.length - 1) {                                    ids = ids + ",";                                }                            }                            Ext.MessageBox.show({                                title: "所选ID列表",                                msg: ids                                //icon: Ext.MessageBox.INFO                             })                        }                    }                }]            },            {                dock: 'bottom',                xtype: 'pagingtoolbar',                store: employeeStore,                pageSize: 3,                displayInfo: true,                displayMsg: '顯示 {0} - {1} 條,共計 {2} 條',                emptyMsg: '没有数据'            }],            height: 400,            width: 800,            disableSelection: false,            renderTo: 'grid'        });


为什么一直出现 grid.getSelectionModel()没有定义。

------解决方案--------------------------------------------------------
.getSelection()是不是少个s 还是没这个方法。
------解决方案--------------------------------------------------------
var gg=new Ext.grid.gridPanle({........});
gg.getSelectionModel()
.......
好象4没变那么凶吧.
  相关解决方案