PDA

View Full Version : Ext.grid.CheckColumn editable



rimbaudsolaris
19 May 2010, 3:12 AM
Is it possible to have on Ext.grid.GridPanel an editable checkbox ?
I just need to be able to edit the check box column and not allow the user to edit the other columns of the gridpanel

Thx for your help

Condor
19 May 2010, 3:43 AM
Use Ext.ux.grid.CheckColumn (from samples/ux) or Ext.grid.CheckboxSelectionModel depending on your needs.

rimbaudsolaris
19 May 2010, 4:36 AM
Ok thx it work fine now.
But now I need add an event in order to call java controler and update the the field behind the checkbox

Here my check box :

var checkColumn = new Ext.grid.CheckColumn({
header: 'user Notification?',
dataIndex: 'userNotificationFlag',
width: 100
});

Thx

Condor
19 May 2010, 4:41 AM
The store fires an 'update' event for every changed record.

rimbaudsolaris
19 May 2010, 5:25 AM
I put update on my store but when I click on my checkbox the alert message is not called

var store = new Ext.data.Store({
url: '<c:url value="/comref/jsonSybilUsers.do"/>',

reader: new Ext.data.JsonReader({
root: 'users',
id: 'id',
totalRecords: 'rows',
listeners: {
update: function(store){
alert('toto');
}
}


}, [
{name: 'id', mapping: 'id'},
{name: 'userNotificationFlag', mapping: 'userNotificationFlag'}
]

)
});

rimbaudsolaris
19 May 2010, 6:06 AM
Ok it works now like the code below
Now I just need to call a java controller to update the field behind

var store = new Ext.data.Store({
url: '<c:url value="/comref/jsonSybilUsers.do"/>',

reader: new Ext.data.JsonReader({
root: 'users',
id: 'id',
totalRecords: 'rows'

}, [
{name: 'id', mapping: 'id'},
{name: 'userFirstName', mapping: 'userFirstName'},
{name: 'userNotificationFlag', mapping: 'userNotificationFlag'}
]

),

listeners: { // add a cellclick listener to the grid
update: function(store){
Ext.MessageBox.alert('title','inside function');

}
}
});

rgeib01
28 May 2010, 8:07 AM
may not be the right thread for this, but was wondering how i could actually check a checkColumn plugin column programmatically....is there any way? I'm having a heck of a time using the EditorGridPanel along with the checkColumn - mainly because I also want to have a checkbox in the header as well that, when checked, automatically checks all of the checkboxes in its column. However, the CheckboxSelectionModel doesn't work for me because it it doesn't have dataIndex and because it's truly a row selection model (I don't want the row highlighted when a checkbox is clicked). I've rigged something up so that I have a checkbox in the header (it's not very pretty!), but I don't see any way to check the columns programmatically...

mitchellsimoens
28 May 2010, 9:05 AM
If you update the record, the changes should reflect in the grid. So update the field that you have the checkcolumn and it will check/uncheck