View Full Version : Disabling grid cell based on value of another cell of same grid

21 Oct 2009, 3:19 AM
I am using editable grid panel. For some rows based on value of user type cell value I need to disable salary cell value for the same row.

For which I read the docs and used isCellEditable feature of the ColumnModel. Now user can not modify the cell value for user role(combo editor) as required.

I am facing UI issue.

Question :-

How to change cell's UI (class) so that cell appears disabled and looks different from other cells which are editable.

Waiting for your response.

21 Oct 2009, 3:52 AM
Use a renderer, there should be examples in Grid FAQ demonstrating similar.

21 Oct 2009, 10:02 AM
Some how you Need to change class of grid cell of some of the row.

21 Oct 2009, 10:05 AM
Thanks for your reply.

But rendrer does not solves my problem. I tried using rendrer and then used

function cellRendrer(value){
return '<span style="background-color:blue">'+value+'</span>';

But this only changes cell contents background color and rest of cell background remains same as earlier. I need to show whole cell disabled.

Let me put my question differently

How can I change background color of grid cell so some rows based on cell value?


21 Oct 2009, 10:40 AM
try this in your renderer..

p.css = "disable-cell" ; //this changes the cell background-color
return '<span style="color:#FF00FF; font-weight =bold">' +val + '</span>'; //this will color the text of the cell

background-color: grey !important;

Hope this helps.

21 Oct 2009, 9:49 PM
Thanks a lot friend. :)