How do you set an entire grid to "disabled" or "readonly" in javascript?
I looked at the docs but didn't see any options or methods to do so:
http://help.infragistics.com/jQuery/2011.2/ui.iggrid
Thanks Borislav! This works perfectly. It's a shame there's not a built-in 'readonly' method, but this was pretty straight-forward.
Just wanted to add that anyone who wants to do this should probably namespace the event handling. Then, when you unbind the "cancelling" handlers when readonly is set to false, you won't unbind any other handlers attached to these events.
http://docs.jquery.com/Namespaced_Events
Hi Josh,The most consistent approach I can think of and I can recommend is to cancel the ING events of the features you have set up on the igGrid.For example, you can cancel the columnSorting event of the sorting feature - that way the sorting feature is present, but no sorting will be carried out until the event handler you've set up returns true.Let me back up a little and start off with this help article:http://help.infragistics.com/NetAdvantage/jQuery/2012.1/CLR4.0?page=Using_Events_in_NetAdvantage_for_jQuery.htmlIt will help you understand how to hook event handlers to the igGrid that you've set up via MVC.
Next is the mention that if you take a look at the sorting feature's events for example (http://help.infragistics.com/jQuery/2012.1/ui.iggridsorting#events) you will see that:
Finally, another point of reference is the Samples Browser - just go to http://samples.infragistics.com/jquery/grid and expand the FEATURES LIST item in the left-side menu.There you will see a search field - type in "API" in it and you will receive a list of API-related samples for the igGrid - all of them show both the sample-specific API, but a set of events as well.For example:http://samples.infragistics.com/jquery/grid/sorting-api and http://samples.infragistics.com/jquery/grid/selection-apiYou can take a look at the code samples in the Code View section of these samples - there you will see event handlers that are used in each sample.Finally, the last upside to this approach is that if you are using a "readonly flag", you can simply return it in each -ing event handler so that when that flag becomes true, the user will automatically be able to use the grid's feature(s).As comprehensive as this reply may be, please let me know if there are any uncertainties or clarifications that you need to get accomplish your scenario with the igGrid.Cheers!Borislav
Thanks, but this isn't exactly what I'm looking for. Sorry, should have been more specific. What I want is something like a regular html control's "Readonly" or "Disabled" attribute, where the control is completely uneditable and indicates this visually (in most cases they're "greyed out").
In the case of the IgGrid, I would want the user to be unable to make any selections, sort, or use any of the other Grid functionality.
I should also mention that my grid is generated from the MVC Helper, just in case there are inconsistencies between this and the client-side generation.
Hi, have you tried this?
//Initialize
$("#grid").igGrid({
features: [
{
name: "Updating",
editMode: "none",
enableAddRow: false,
enableDeleteRow: false
} ]});
//Set
$("#grid").igGridUpdating("option", "editMode", "none");
$("#grid").igGridUpdating("option", "enableDeleteRow", false);
$("#grid").igGridUpdating("option", "enableAddRow", false);