PDA

View Full Version : How to disable the ComboBox in Grid depends on the displayed value



erosszz
3 Feb 2010, 6:43 PM
the grid fills data from the server and set the comboBox's initial displayed value
comboBox in grid contains "OK" "OK Error" "Not Good"

would like to disable the comboBox if the initial displayed value is "OK"

could you guide me..

thanks

dlbjr
4 Feb 2010, 5:58 AM
//Global variable to function
var isDisabled = true;

//Colum in Editable Grid
, {
header: 'Title',
dataIndex: 'score',
align: 'center',
hideable: true,
sortable: true,
hidden: false,
width: 60,
renderer: function(data, cell, record, rowIndex, columnIndex, store) {
switch (data) {
case 1:
counter++;
cell.css = 'no_red';
isDisabled = false;
return'OK Error';
case 2:
cell.css = 'no_red';
isDisabled = false;
return'Not Good';
default:
cell.css = 'yes_green';
isDisabled = true;
return'OK';
}
},
editor: new Ext.form.ComboBox({
store: ds,
valueField: 'item_id',
displayField: 'item_desc',
mode: 'local',
triggerAction: 'all',
width: 75,
typeAhead: true,
selectOnFocus: true,
forceSelection: true,
disabled: isDisabled
})
}

erosszz
4 Feb 2010, 4:32 PM
Sir Thanks a lot..

the renderer's function's arguments are automatically pass by the ExtJs?

the counter variable inside the renderer's function is your own variable? or provided by the ExtJs?

the ds in the store:ds is the grid's store?

dlbjr
4 Feb 2010, 5:29 PM
Yes!

No, the ds is the "data store" used to populate the drop down Combo Box.

counter++; is not needed. It was code I copied from and missed taking this line out. Sorry!

erosszz
4 Feb 2010, 6:13 PM
>>the renderer's function's arguments are automatically pass by the ExtJs?
>Yes!

Thanks for confirmation Sir. actually that is one the problem with the API Doc...all possible arguments in the renderer config option of every components are not documented. I do trial and error to know it. If I'm wrong, please correct me...


>>the ds in the store:ds is the grid's store?
>No, the ds is the "data store" used to populate the drop down Combo Box.

ComboBox has its own store?



Right now, I'm trying to apply then do some changes..
Will update this thread.

ironlion
4 Feb 2010, 6:48 PM
See http://www.extjs.com/forum/showthread.php?t=91299

erosszz
4 Feb 2010, 7:09 PM
Sir ironlion... those threads are started by me..
those are different topics..


See http://www.extjs.com/forum/showthread.php?t=91299