views:

51

answers:

1

How can I make an entire jqGrid disabled/readonly?

I have a page with a logical "edit section" which I show when the user selects something to edit, and hide when the user is done editing (save or cancel). While the edit section is shown, I disable several other elements on the page. I would like to disable their ability to click in the jqGrid, so they can't change selected rows, re-sort, etc. But I cannot find a way to disable/enable the grid as a whole.

Apologies if this has been answered already - other questions seemed to focus on disabling only certain behaviors within the jqGrid.

Edit: Preferably, I'd like an approach that isn't dependent on yet another 3rd-party addon. Nothing wrong with them, of course! But my client has a degree of reluctance with them, so my life would be a little easier with a purely jQuery/jQueryUI/jqGrid solution. :)

+1  A: 

You could use blockUI to block the grid.

redsquare
+1, this is exactly what my application does when an "Edit", although in that case a jQuery UI dialog is displayed.
Justin Ethier
Thanks - that addon looks useful. My client is sometimes reluctant to pull in additional 3rd-party code - especially when a licensing policy isn't clearly stated, as is the case with blockUI.I'm going to keep that addon "in my back pocket" as a possible solution, but I'm still holding out hope that someone can point me to a similar solution without dependence on another 3rd-party library.
mikemanne
mikemanne the plugin, as any plugin available on jquery.com, is dual license (MIT/GPL). Malsup will confirm this by email or twitter. Otherwise why not just replicate the functionality. It is just a simple opaque div on top of an element.
redsquare
redsquare: thanks - I didn't know that all jQuery plugins shared a common license policy - that's good to know. I've always been stronger on the server-side than the UI side, so overlaying one div precisely over another (and keeping it there through window resizes and scrolls) probably isn't as turn-key for me as it is for more experienced css/js devs. However, I'm sure I can track down a solid sample online.
mikemanne