PDA

View Full Version : How can I add multiple checkbox in editorgridpanel?



missg
15 Jan 2013, 8:03 PM
I'm using extjs 3.4 and I need to add multiple checkbox in editorgridpanel.

I can add checkbox more than one I can by Ext.ux.grid.CheckColumn object but when I add 'checkchange' listeners it not working.

Here is my code ..

...
<script type="text/javascript" src="../ux/CheckColumn.js"></script>
...
...
var cNameColumn = new Ext.grid.CheckColumn({
header: 'Change Name',
dataIndex: '_flag1',
listeners : {
checkchange : function(column, recordIndex, checked) {
alert(checked);

}
}
});

var cDescColumn = new Ext.grid.CheckColumn({
header: 'Change Desc',
dataIndex: '_flag2',
listeners : {
checkchange : function(column, recordIndex, checked) {
alert(checked);

}
}
});


//Column Model
var cm = new Ext.grid.ColumnModel( {
defaults: {
sortable: true
},
columns: [
cNameColumn,
cDescColumn,
{ header: "ID", dataIndex: 'id', align: 'center', width: 40 },
{ header: "Name", dataIndex: 'name', editor: new Ext.form.TextField({ allowBlank: false, minValue: 0, maxValue: 30, maxLength: 30 }) },
{ header: "Description", dataIndex: 'description', editor: new Ext.form.TextField({ allowBlank: false, minValue: 0, maxValue: 30, maxLength: 30 }) }

]
});

var store = new Ext.data.Store({
id: 'store',
autoLoad: true,
proxy: new Ext.data.HttpProxy({
url: 'test_proxy.php',
method: 'POST'
}),
baseParams:{
task: "get_member"
},
reader: new Ext.data.JsonReader({
root: 'results',
totalProperty: 'total',
id: 'id'
},[
{name: 'id', type: 'string', mapping: 'ID'},
{name: 'name', type: 'string', mapping: 'NAME'},
{name: 'description', type: 'string', mapping: 'DESCRIPTION'}

])
});


var editorgrid = new Ext.grid.EditorGridPanel({
id: 'editorgrid',
store: store,
cm: cm,
renderTo: 'editor-grid',
width: 600,
height: 300,
title: 'Demo',
frame: true,
clicksToEdit: 1
});

Please help ...

saJoshua
16 Jan 2013, 2:35 AM
isnt this a working example of a checkbox grid column? try listen rather on cellclick of the grid.

http://dev.sencha.com/deploy/ext-3.4.0/examples/grid/edit-grid.html

muliyono.lu
17 Jan 2013, 3:48 AM
Your problem is the listeners doesn't work
Is it right?
You could see the example from this

http://dev.sencha.com/deploy/ext-3.4.0/examples/grid/grid-plugins.html
in section grid 4

Sandhya0729
17 Feb 2013, 1:30 PM
Hi,

I am using the checkcolumn xtype for multiple columns in my grid. I want to provide the user an option to selectall for a these columns.

found an example for CheckBoxSelectionModel(), but I don't want to select all rows, but I just want to selectall cells in a specific column.

I am using extjs 3.4.

I would really appreciate if someone could help me with creating a single column selectall.

Thanks,
Rano