I am using jqGrid and I'm trying to add a data- attribute to each tr. I'm firing the loadComplete event, but I'm unsure of how to modify each row. Any code samples?
You can use rowattr
to assign any additional attribute to <tr>
elements (see the answer and this one for code examples). For example you can use
rowattr: function (rd) {
return {"data-mydata": JSON.stringify(rd)};
}
to save full input row data as data-mydata
attribute. I recommend you to use rowattr``in combination with
gridview: true` option to have the best performance results ()
The demo uses above rowattr
cade and you can see that rows of grid have additional data-mydata
attribute:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With