Pass row.index var to editor_view button a href

Pass row.index var to editor_view button a href

Restful Web ServicesRestful Web Services Posts: 202Questions: 49Answers: 2
edited May 2015 in Editor

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

  • allanallan Posts: 61,694Questions: 1Answers: 10,102 Site admin
    Answer ✓

    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

  • Restful Web ServicesRestful Web Services Posts: 202Questions: 49Answers: 2

    Great, thanks. That example worked perfectly.

This discussion has been closed.