ExtJS Tips & Tricks: Making EditorGridPanel (Ext.grid.EditorGridPanel) readonly at runtime in Extjs

I was wondering how i could make EditorGridPanel readonly at runtime. Finally I managed to find out a way to do this. What you have to do is register an handler for grid’s beforeedit event which will return false !!!

say, you need a function which will do this:


//handler function for 'beforeedit' event
function handler_to_makeReadOnly(){return false;}
//function to make EditorGridPanel read only
function MakeEditorGridPanelReadOnly(editorGridPanel)
{
 editorGridPanel.on('beforeedit',handler_to_makeReadOnly,this);
}
//function to make EditorGridPanel normal(editable)
function MakeEditorGridPanelUnReadOnly(editorGridPanel)
{
 editorGridPanel.un('beforeedit',handler_to_makeReadOnly,this);
}

Note: MakeEditorGridPanelUnReadOnly will just remove the effect of MakeEditorGridPanelReadOnly function by unregistering the handler handler_to_makeReadOnly. If grid column models are read only it wont change them, means those columns will still be read only.

If you find any problem just write a comment to reach me.

Modification History:

1. 05 Nov 2009: Made the code block proper.

Advertisements

The URI to TrackBack this entry is: https://indiandeve.wordpress.com/2009/10/19/extjs-tips-tricks-making-editorgridpanel-ext-grid-editorgridpanel-read-only-at-run-time-in-extjs/trackback/

RSS feed for comments on this post.

One CommentLeave a comment

  1. thank you work for me


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: