disable sorting on specific row using css class
disable sorting on specific row using css class
hi,
i'm very impressed by your datatables very nice work man :)
i have only one problem in my implementation: i have a grid with column that i don't want to be sortable (there are buttons so it's pretty useless to sort it). But the only solution i've found is to write down an array describing col by col whether to be sortable or not. My situation is more complex - i have several views including with different count of cols in the table, so i'm not able to write it to an array. Is there some possiblity to set that column with class="buttons" won't be sortable?
Thanks a lot :)
i'm very impressed by your datatables very nice work man :)
i have only one problem in my implementation: i have a grid with column that i don't want to be sortable (there are buttons so it's pretty useless to sort it). But the only solution i've found is to write down an array describing col by col whether to be sortable or not. My situation is more complex - i have several views including with different count of cols in the table, so i'm not able to write it to an array. Is there some possiblity to set that column with class="buttons" won't be sortable?
Thanks a lot :)
This discussion has been closed.
Replies
Thanks for the kind words. I think you've hit upon the biggest annoyance / limitation with DataTables at the moment - the need to specify every column in the aoColumns array. I plan to ease this in v1.7 (when that happens), although not 100% what the best way is to do it yet), but intil then what you could perhaps do, is to dynamically construct aoColumns based on information in the DOM. So a little loop over the column headers looking for a class and contructing an array would do the trick nicely I think.
Regards,
allan
thanks for quick reply
i'll try to solve it as you described
lookin forward 1.7 version :)
i'll check your project from now often!
bless :)
Answer please.
Have you decided the issue?
Thanks
the last row of the table is the sum of the columns. When sorting, this line should not move.
Answer please, can I make it the standard tools? Or, for example, sort, and then fnDrawCallback moved to the bottom of the table this row.
Similar questions on the forum was a lot, I think the answer will be helpful to many.
Your question sounds quite different:
> the last row of the table is the sum of the columns. When sorting, this line should not move.
So a footer then? Something like this: http://datatables.net/examples/advanced_init/footer_callback.html
Allan
footer callback not suitable.
If you want a row to always be visible, regardless of the sorting, it either needs to be in the header or footer - or dynamically injected on each draw.
Allan
I am running into the same problem as Alexander. I need the last row of my table to not sort because is hold the table's Totals. Of coarse this should be placed in a tfoot row however, when a user prints the table the footer repeats on every page. I don't like this because it looks like the totals on each page pertain to that specific page when in reality it is the total of all the pages. It leads to confusion for the users. The only quick work around I see is to have a separate table that holds just the totals right under the table being sorted. This way it looks like a footer row, will remain in place when paging and will print only once on the last page.
To keep the columns formatted with the same widths:
[code]
$("#masterTable th").each(function(i){
$("#footerTable td").eq(i).css('width', $(this).width())
})
[/code]
perfect solution and it looks good