Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable/Disable a custom button in jqGrid

Tags:

jquery

jqgrid

I am creating a custom button by using "navButtonAdd". I want to enable/disable this button. How do I do this?

grid.navButtonAdd("#pg_List1_toppager", { caption: "", buttonicon: "icon-archive", onClickButton: customSearch, position: "first", title: "Archive", cursor: "pointer", disabled: "disabled" });
like image 974
ZSH Avatar asked May 20 '26 23:05

ZSH


1 Answers

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.

like image 55
Oleg Avatar answered May 23 '26 11:05

Oleg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!