FixedColumns - Freeze arbitrary columns
FixedColumns - Freeze arbitrary columns
As far as I understand, for the time being the fixedColumns plugin only allows to select a continuous interval of columns on the left and/or right of the table. Is it possible to freeze an arbitrary set of columns?
For instance, we have a table with the following set of columns { Col1, Col2, Col3, Col4, Col5 } and we want to freeze Col2 and Col5 so that the final table looks like this { fCol2, fCol5, Col1, Col3, Col4 }.
Is such a configuration possible and is there a workaround for this if it's not.
Thanks in advance.
Artjom
For instance, we have a table with the following set of columns { Col1, Col2, Col3, Col4, Col5 } and we want to freeze Col2 and Col5 so that the final table looks like this { fCol2, fCol5, Col1, Col3, Col4 }.
Is such a configuration possible and is there a workaround for this if it's not.
Thanks in advance.
Artjom
This discussion has been closed.
Replies
No - this is not possible. You are looking for a floating column in the middle of the table? What is the use case?
If you want columns 2 and 5 at the start of the table (not eh left), why not reorder your table so that columns 2 and 5 are in that position?
Allan
It is exactly as I have described in the previous post (let's assume that columns to freeze are specified in the script).
-------existing table------------columns 2 and 5------table with columns 2 and 5 frozen-------
{ Col1, Col2, Col3, Col4, Col5 } ----after freeze---> { fCol2, fCol5, Col1, Col3, Col4 }
Right now it seems that it works like this. We set, for instance,
"iLeftColumns": 2
and then two columns on the left would be frozen, that is,
{ Col1, Col2, Col3, Col4, Col5 } ----after freeze---> { fCol1, fCol2, Col3, Col4, Col5 }
Actually what I describe is already available in another framework jEasy UI that is also based on jQuery. However, I was unable to make it work with the existing table. Perhaps, you can take a look and see the use case that I describe.
http://www.jeasyui.com/tutorial/datagrid/datagrid5.php
Best regards,
Artjom
Allan
:) Thanks allan.
The tables are part of the XML documents generated at runtime by the backend. At the next step these files would be transformed with the corresponding XSLT files into HTML pages and rendered by the browser. In the transformation phase the set of frozen columns for the tables have to be provided, that is they have to be specified in XSLT files used for transformation. Depending on the service used there could be different set of columns frozen (this means it has to be configurable through xslt by the portal maintainers).
That's why I can't simply change the order by hand :).
You've proposed to use ColReorder plugin in combination with FixedColumns to programmatically rearrange the order of the tables before applying a column freeze. I looked through the examples provided but wasn't able to determine how to use these two plugins together for such a scenario.
Any help would be appreciated.
So you'd use the aiOrder option of ColReorder to do the initial reorder during the initialisation of the table: http://www.datatables.net/extras/colreorder/options#aiOrder . Then add FixedColumns as normal.
Allan