问题
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:
You could use blockUI to block the grid.
回答2:
Try using $("#lui_" + myGridId).show()
.
The grid has created this overlay internally an uses it as one part of the loader message. You can just show it or hide it and it will disable/enable the grid for you.
来源:https://stackoverflow.com/questions/3206912/how-to-make-an-entire-jqgrid-disabled-readonly