Setting data attribute on each row of a jqgrid table
问题 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? 回答1: 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