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?
相关问题
- How to bind a dropdown list inside jqgrid row cell
- jQgrid filterToolbar fails with searchOnEnter
- Detecting checkbox event in jqGrid cell
- How to alter data received from the server before
- How to access other row data from a cell's cus
相关文章
- jqGrid Row Object in onSelectRow
- Weird behavior of jqgrid Grouping
- jQuery - jqGrid - submit buttons in each row
- JqGrid: sorting of local data
- How to Expand/Shrink row in Jqgrid dynamically
- VB.net FileUpload using Ajaxcall
- jqGrid addRowData doesn't work with grid as su
- How to turn off column highlighting (on hover) for
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 useto save full input row data as
data-mydata
attribute. I recommend you to userowattr``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 additionaldata-mydata
attribute:In my cases, I set the first column of grid by an identity. And in all my cases, id of each data row of my grids is the value of that identity column.
jqGrid column:
Rendered :
So, if you have similar declarations like me, this could be a useful selector for you and you can simply add your data- attrib to these rows like this:
And if you want the above line to be performed automatically to all rows, you should change it slightly and put it into the
gridComplete
event of your grid: