PDA

View Full Version : Dynamically editable or static cell in the grid?



neerajnandwana
26 Jan 2008, 2:16 AM
I have a gird with 2 columns. I want to make first column’s cell combo box when 2nd column value is NO.
Grid::-/
___________________
| static text.......| YES |
| <combo box> | NO.. |
| static text.......| YES |


How can I dynamically make the cell editable or static :s?

Thanks in Advance

Condor
26 Jan 2008, 2:28 AM
You should override the isCellEditable function, e.g.


isCellEditable: function(colIndex, rowIndex) {
if ((colIndex == 0) && (grid.store.getAt(rowIndex).get('name-of-second-column') != 'NO')) {
return false;
}
return (this.config[colIndex].editable || (typeof this.config[colIndex].editable == "undefined" && this.config[colIndex].editor)) ? true : false;
}

neerajnandwana
26 Jan 2008, 3:33 AM
Thanks condor for your reply,
[SIZE=3][FONT=Times New Roman] (:|But it

Condor
26 Jan 2008, 3:37 AM
See my example.

1. Check the colIndex to see if this is the first column.
2. Retrieve the current record based on the rowIndex.
3. If the data in the second column is not 'NO' return false (don't edit).
4. Otherwise return default value from ColumnModel.

neerajnandwana
26 Jan 2008, 4:17 AM
Hey it