在jqGrid中启用/禁用自定义按钮

ZSH*_*ZSH 3 jquery jqgrid

我正在使用"navButtonAdd"创建自定义按钮.我想启用/禁用此按钮.我该怎么做呢?

grid.navButtonAdd("#pg_List1_toppager", { caption: "", buttonicon: "icon-archive", onClickButton: customSearch, position: "first", title: "Archive", cursor: "pointer", disabled: "disabled" });
Run Code Online (Sandbox Code Playgroud)

Ole*_*leg 10

First of all I would recommend you to use id option of navButtonAdd which allows assign id attribute to the button. It makes easier to address the button later. To disable the button you can add class "ui-state-disabled" to it. To enable the button you can remove buttons.

I would recommend you to examine the demo from the answer and another demo from the answer which hide/show non-active buttons of navigator bar.