Your current code has some disadvantages. I would recommend you to use formatter: "actions"
with the option formatoptions: { editformbutton: true }
instead of custom formatter to create edit/delete buttons (see the old documentation, which describes the options of the formatter, for example delbutton: false
, which remove Delete button) in every row of the grid. The old answer describes the approach more detailed and provides the demo, which demonstrates the usage of formatter: "actions"
.
If you would do prefer to use custom formatter, then you could use <span>
instead of <a>
:
return "<span class='GetLink'>" + cellvalue + "</span>";
where
.GetLink { text-decoration: underline; cursor: pointer; }
Instead of usage $('.GetLink').click
, which register separate click-handler for every hiperlink, I'd recommend you to use one click-handler on the grid. jqGrid register already such click-handler and allows to use your custom actions with respect of beforeSelectRow
callback. It saves memory of the web browser and allows to make binding once instead of reapplying binding after every reloading of the grid. See the answer for more details.
Other answers, which could be helpful for you: this one and this one.