PDA

View Full Version : Can you conditionally disable rows in the GridPanel?



parky128
10 Oct 2011, 6:49 AM
Hi,

Is it possible to prevent rows from being selected in a grid panel based on some condition? I have a checkbox selection model and am returning false in the beforerowselect handler so the row cannot be selected, but I need a visual cue to the user that the row is disabled such as greying it out.

Can anyone point me in the right direction please?

Thanks

parky128
11 Oct 2011, 2:59 AM
I found a way to do this in the end. In the 'viewready' event of the grid component I ended up looping through the underlying stores records and based on a certain condition just applied a mask to the row element by looking up the the index of the row that matched the condition.

Code:


this.grid.store.each(function(rec) {
if(condition==true) {

Ext.get(this.grid.view.getRow(this.grid.store.indexOf(rec))).mask();
}

}, this);