colReorder plugin issues with column().cache() API
colReorder plugin issues with column().cache() API
vismark
Posts: 79Questions: 5Answers: 0
Hi, with reference to this fiddle, it looks like the column().cache() API doesn't work anymore after a colReorder. You can try switching the first and the second column...after that the API won't return data until you redraw the table. Is there any workaround I can apply?
Replies
Use
colReorder.transpose()
to get the current index.Kevin
I'm not tryin to get column index, I'm tryin to get column's data
The
colReorder.transpose()
API provides the current column index. Instead of using this for the first column:Use this to get the reordered index of the first column:
See this example:
http://live.datatables.net/fiyugequ/1/edit
Move the columns and you will always see the data from the Name column no matter where it is placed.
Kevin
Thanks Kevin, I know this but it has nothing to do with what I'm saying.
If you take a look at the example you can see that I've explicitly targeted column 0 before colReorder and column 1 after colReorder to simplify the situation...and the API is not working on ANY column index I may target...so your solution has nothing to do with that problem I'm in. Please try the fiddle...
Sorry, misunderstood the question. The
column().cache()
states this:I don't know the internals of Datatables but it seems like reordering the columns clears the
search
cache. I addeddt.draw( false );
to the event handler and the cache is populated so the API works.https://jsfiddle.net/htuqj3dn/
Please describe what you are trying to do see we can offer suggestions.
Kevin