Stephen Patten
Stephen Patten

Reputation: 6363

How to add a custom button to a jqGrid row that does NOT select the row when clicked

This example from Oleg is very close to the behavior I'm looking for (the first button) but I want preserve whether or not it was highlighted if possible, and don't want to highlight a row and check on the check box if it was un-selected. Just to clarify, I will be popping a modal dialog if they click this button, it has nothing to do with editing the row.

http://www.ok-soft-gmbh.com/jqGrid/Admin3.htm

Thank you, Stephen

Upvotes: 0

Views: 2372

Answers (1)

Oleg
Oleg

Reputation: 221997

To prevent highlighting of the row in which the custom button will be clicked one need just include return false; inside of click event handler:

click: function(e) {
    alert("'Custom' button is clicked in the rowis="+
        $(e.target).closest("tr.jqgrow").attr("id") +" !");
    return false; // !!!!!
}

The demo demonstrate the results. It's the updated version of the demo from the answer and the previous one which you referenced in your question. Additionally I updated the code of myDelOptions.onclickSubmit based on the code from the answer.

Upvotes: 1

Related Questions