Ordering from right to left?
Ordering from right to left?
I'm currently using HubSpot to display a lot of data in a table across 13 columns. Using DataTables I am able to order this data based on the 13th column which works perfectly.
"order": [[ 12, 'asc' ]] /* columns from left to right starting at 0 */
However, as this module is reused across many pages on my website, I've written a condition which hides the first column if you're on a particular page, meaning that you may only see 12 columns - breaking the order value.
Is there a way to reverse the order to read right to left so my 13th column becomes 0?
This question has an accepted answers - jump to answer
Answers
Not as such, but you can do a sum in the
order
so that it calculates how many columns there are before anything is hidden, something like this example here:Colin
No, the numbering is using Javascript indexes.
How are you hiding the column? If you use
columns.visible
with the 13 columns then the index should still be correct.Kevin
Hi @kthorngren I'm using HubSpots own HubL language to hide the column as it gives me a lot of flexibility. That said, I wasn't aware of the 'columns.visible' option. I will bare this in mind going forward. Thanks for the heads up.