PDA

View Full Version : How to add a checkbox column in a gridpanel in ExtJS4.0.2



bill_chuang
16 Aug 2011, 8:59 PM
Now I want to add a checkbox column in a gridpanel like this.27513
Andbody help me?

slemmon
16 Aug 2011, 9:55 PM
There is an example here on this page:
http://dev.sencha.com/deploy/ext-4.0.2a/examples/grid/grid-plugins.html

* (http://dev.sencha.com/deploy/ext-4.0.2a/examples/grid/grid-plugins.html)extract


var sm = Ext.create('Ext.selection.CheckboxModel'); var grid2 = Ext.create('Ext.grid.Panel', { store: getLocalStore(), selModel: sm, columns: [ {text: "Company", width: 200, dataIndex: 'company'}, {text: "Price", renderer: Ext.util.Format.usMoney, dataIndex: 'price'}, {text: "Change", dataIndex: 'change'}, {text: "% Change", dataIndex: 'pctChange'}, {text: "Last Updated", width: 135, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'} ], columnLines: true, width: 600, height: 300, frame: true, title: 'Framed with Checkbox Selection and Horizontal Scrolling', iconCls: 'icon-grid', renderTo: Ext.getBody() });

bill_chuang
17 Aug 2011, 1:53 AM
There is an example here on this page:
http://dev.sencha.com/deploy/ext-4.0.2a/examples/grid/grid-plugins.html

* (http://dev.sencha.com/deploy/ext-4.0.2a/examples/grid/grid-plugins.html)extract


var sm = Ext.create('Ext.selection.CheckboxModel'); var grid2 = Ext.create('Ext.grid.Panel', { store: getLocalStore(), selModel: sm, columns: [ {text: "Company", width: 200, dataIndex: 'company'}, {text: "Price", renderer: Ext.util.Format.usMoney, dataIndex: 'price'}, {text: "Change", dataIndex: 'change'}, {text: "% Change", dataIndex: 'pctChange'}, {text: "Last Updated", width: 135, renderer: Ext.util.Format.dateRenderer('m/d/Y'), dataIndex: 'lastChange'} ], columnLines: true, width: 600, height: 300, frame: true, title: 'Framed with Checkbox Selection and Horizontal Scrolling', iconCls: 'icon-grid', renderTo: Ext.getBody() });
Thanks.It's helpful