µ±Ç°Î»Ö㺠´úÂëÃÔ >> 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: '†T¹¤½¨™n',            store: employeeStore,            selModel: selModel,            columnLines: true,            columns: [                Ext.create('Ext.grid.RowNumberer'),              { header: '†T¹¤¾ŽÌ–', dataIndex: 'EMPNO', width: 80 },              { header: 'ÐÕÃû', dataIndex: 'FULLNAME', width: 120 },              { header: 'µØÖ·', dataIndex: 'ADDRESS', flex: 1 },              { header: 'Äêýg', 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: '²¿éT¾ŽÌ–', 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: '„h³ý',                    tooltip: '„h³ýÓÑôÙYÁÏ',                    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} —l£¬¹²Ó‹ {2} —l',                emptyMsg: 'ûÓÐÊý¾Ý'            }],            height: 400,            width: 800,            disableSelection: false,            renderTo: 'grid'        });


Ϊʲôһֱ³öÏÖ grid.getSelectionModel()ûÓж¨Òå¡£

------½â¾ö·½°¸--------------------------------------------------------
.getSelection()ÊDz»ÊÇÉÙ¸ös »¹ÊÇûÕâ¸ö·½·¨¡£
------½â¾ö·½°¸--------------------------------------------------------
var gg=new Ext.grid.gridPanle({........});
gg.getSelectionModel()
.......
ºÃÏó4û±äÄÇôÐ×°É.
  Ïà¹Ø½â¾ö·½°¸