ColReorder: prevent dragging any column before first column (even if first column hidden)
ColReorder: prevent dragging any column before first column (even if first column hidden)
maartenmachiels
Posts: 13Questions: 0Answers: 0
Hello Allan
I've been tinkering with ColReorder for my client: wonderful!
However, I'm seeing some small problems. My first column always contains the ID of the row record for use with some custom functionality I've implemented (access record on doubleclick, multiple options on single click...). I'm using ColVis, and the first column (ID) is hidden by default.
Now, if I drag a column to the front of my DataTable my custom functionality is broken (because it assumes that the data in the first column is the ID, and now other data is in the first column). That's the first problem. The second problem is that when I reload the page after dragging a column to the front of the table (I'm state saving via localStorage) my table is messed up. Even though the first column header will say for instance "Last Name", the data of the first column is still "ID", now visible.
My question is as follows: would it be possible to prevent dragging any column to precede the first (ID) column, even if this column is hidden?
I'd be glad to PM you a link and login details of my testcase, but I cannot post it here openly since it contains some sensitive data.
Could you please shed some light on this? Thank you thank you kindly!!
I've been tinkering with ColReorder for my client: wonderful!
However, I'm seeing some small problems. My first column always contains the ID of the row record for use with some custom functionality I've implemented (access record on doubleclick, multiple options on single click...). I'm using ColVis, and the first column (ID) is hidden by default.
Now, if I drag a column to the front of my DataTable my custom functionality is broken (because it assumes that the data in the first column is the ID, and now other data is in the first column). That's the first problem. The second problem is that when I reload the page after dragging a column to the front of the table (I'm state saving via localStorage) my table is messed up. Even though the first column header will say for instance "Last Name", the data of the first column is still "ID", now visible.
My question is as follows: would it be possible to prevent dragging any column to precede the first (ID) column, even if this column is hidden?
I'd be glad to PM you a link and login details of my testcase, but I cannot post it here openly since it contains some sensitive data.
Could you please shed some light on this? Thank you thank you kindly!!
This discussion has been closed.
Replies
After some investigation, I've figured out how to fix the first column. If I set iFixedColumns to 1 it seems to fix the problem:
[code]
"oColReorder": {
"iFixedColumns": 1
}
[/code]
However, upon reloading the page, statesaving seems to have troubles... The headers are in the correct order, but the data is not.
What do I do?
Allan
I've now updated ColVis, I was running 1.1.0-dev, and have now updated to 1.1.0. The problem persists... I can reorder rows, but upon reloading the page the headers are in the correct order. The data itself is not.
My DataTable is populated via Ajax. Could the problem be in there?
Can you link me to a test case showing the problem so I can debug it please?
Allan