s.webbandit
s.webbandit

Reputation: 17028

How to disable certain row in grid in ExtJS 4.1

I want to disable whole Row, all its text content, actioncolumns, editors etc.

Upvotes: 1

Views: 10203

Answers (1)

VDP
VDP

Reputation: 6420

not really possible. I mean it's not in the framework. You can mark a record (=row) as disabled. You could add the functions setDisabled/getDisabled to the model of the store. Then you can call something like:

grid.getStore().getAt(0).setDisabled(true) for the first record

function for the model:

function setDisabled( state ){
    var me = this;
    me.disabled = state;
    me.fireEvent('disabled', state);
}

function getDisabled(){
    return this.disabled;
} 

now you can listen for that event, get the disabled/enabled state. If it's disabled you could add a class to that row (addRowCls( ) - removeRowCls( )) for the visuals. You can listen for the edit event. Then you can prevent editing when the record is disabled.

Not really an out of the box solution but use a little imagination and you'll get there! Hope it helps ;)

Upvotes: 7

Related Questions