Auto Ranking/Incrementing Table Results
Auto Ranking/Incrementing Table Results

Hi All,
I'm trying to auto-increment the results on the fly, with this table:
http://live.datatables.net/yohuluco/1/edit
It has two views via buttons, and then another view from the filter/dropdown control on the right. As any of those change/update the data, I'd like to rank the results from 1 down to X results, via a separate column in the table.
I dug around and only found proposed solutions that were pretty dated, but wanted to see if there's a better/ more accurate/efficient sample of this somewhere I'm missing.
Thanks.
Ed
This question has an accepted answers - jump to answer
Answers
I found this, but am having issues getting it to work with my existing datatable structure..
https://datatables.net/examples/api/counter_columns.html
Yep, that would be the way to go. You would create an extra column for the counter, and use that definition in the
columnDefs
.Colin
Colin,
Can you see what I'm missing here? I realize the JS error happening on the "t" of the init, but I'm not sure how to make that work with my table layout/structure:
http://live.datatables.net/yohuluco/3/edit
Thanks,
Ed
You need to assign
t
to your Datatables API, like this:http://live.datatables.net/vihigohu/1/edit
Kevin
That did work Kevin, thanks. I suppose I was nervous that would alter the workings of some other functionality of the table - and wanted to make the change in the function itself, instead. This does work though, thanks.
You are just getting an instance of the API as decried here.
Kevin
Thanks Kevin. Much appreciated.