ColReorder by columnName instead of indexes

ColReorder by columnName instead of indexes

babablacksheepbabablacksheep Posts: 41Questions: 23Answers: 0
edited August 2014 in Free community support

Hi,
Is it possible to use ColReorder by column names instead of indexes.

I have a situation where I am to provide different table views for the user and user should be able to switch between different views.
Views consist of ColReorder and colVisibilty (some cols at different pos and some columns turned off).
problem is when I use a button to which I have binded a view, Colreoder does work as expected as when first column reordering occurs, indexes are already changed so if it is possible to ColReorder with column name instead of index will b very helpful.

view1Button.click(function (e) {
    table.colReorder.fnOrder([0, 1, 3, 4, 5, 2, 6, 7]);
});

If above button is pressed few times, results are different each time since column indexes have already changed by previous order.
Kindly provide how can i use it with column names like we do with visibility

table.column( ':name').visible(true); 

Something like below will be much appreciated.

table.colReorder.fnOrder([ 'col1:name', 'col2:name', 'col2:name', 'col3:name', 'col4:name']);

Answers

  • babablacksheepbabablacksheep Posts: 41Questions: 23Answers: 0
    edited August 2014

    I was able to fix this with

    view1Button.click(function (e) {
    
        table.colReorder.fnReset();
        table.colReorder.fnOrder([0, 1, 3, 4, 5, 2, 6, 7]);
    
    });
    

    But by Column Name is a must have feature !!!

This discussion has been closed.