Pass row.index var to editor_view button a href
Pass row.index var to editor_view button a href
This is probably really simple but I cannot make it work. I want to pass the dynamic row.index (I think) to my Editor View button default content code so I can add the var to the id.
"defaultContent" : '<a href="" class="editor_view fontawesome-info" id="modal"></a>'
I am using the above and after 'modal' I want the row number, i.e 1 for first row, 2 for second row, etc.... I dont want the row index from my database, I specifically want the displayed row number. So no matter what filtering is occurring or ordering the first row number should always be 1, second row number should always be 2, etc....
Can anyone point me in the right direction of how to get the row number and assign it to a var during my table creation.
Thanks
This question has an accepted answers - jump to answer
Answers
If you want the number to always be 1,2,3... regardless of paging, filtering, etc, then assigning a value during table creation probably isn't going to meet your requirements.
One option is to use something like this example. However, if you need the value to be written to the data for the row, you will need to use the
cell().data()
method rather than writing directly to the HTML.Allan
Great, thanks. That example worked perfectly.