I am using custom edit/delete functions in jqGrid and I really enjoyed the fact that they call your custom function after checking if a row was selected or not.
Now I would like to add two more buttons and I would like to use the same behaviour of the edit/delete, so when a row is selected my function get called but if no rows have been selected they show the default popup that says "please select a row first".
Is there a way to achieve this? Alternatively, is there a way to call the method that is called by the grid itself?
thanks!
You should test whether any row is selected or not inside the onClickButton
method of your custom button (see Jqgrid: navigation based on the selected row as an example). If you want to display exactly the same warning you should follow the code from Preventing the opening of a form on a add button click.
To make all easier I modified an old example for you. On the example you can click on the custom button "My special Action" and see the warning if no row is selected. If some row is selected you can do something with the data from the selected row. Instead of some complex actions I displayed a message only.
UPDATED: The answer to the questions "Adding jqGrid Custom Navigation to Top Toolbar" can be also interesting for you.