jeffreydwalter / ColReorderWithResize

Column reordering and resizing plug-in for DataTables
http://www.datatables.net/
MIT License
42 stars 51 forks source link

Column is not updated when columns are moved. #18

Open KyGuyMayor opened 5 years ago

KyGuyMayor commented 5 years ago

When I move a column, the colReorder.order() function still returns the indexes in the default order.

jeffreydwalter commented 5 years ago

Are you calling order() yourself? Can you provide a piece of code that reproduces the issue?

The order() function takes two arguments: https://github.com/jeffreydwalter/ColReorderWithResize/blob/master/ColReorderWithResize.js#L1739-L1749

KyGuyMayor commented 5 years ago

perhaps I have a misunderstanding of the function. Is there a way to return the current column order after a user has re-ordered columns?

jeffreydwalter commented 5 years ago

@KyGuyMayor nah, you're right. I don't really use this library anymore, so I'm a bit rusty on the API.

jeffreydwalter commented 5 years ago

If you could provide a work (not working) example, I'd be happy to debug it for you (or I will happily accept a pull request that fixes the issue).

vmarinaro commented 4 years ago

Hi, I have try to fix it in this way. In Move the internal array elements after Colums options regenerate I inserted this code.

 /* regenerate event handlers for the drag and drop */
    for ( i=0, iLen=iCols ; i<iLen ; i++ )
    {
        if ( i > oSettings._colReorder.s.fixed-1 && i < iLen - oSettings._colReorder.s.fixedRight )
        {           
            oSettings._colReorder._fnMouseListener( i, oSettings.aoColumns[i].nTh );
        }       
    }
jeffreydwalter commented 4 years ago

@KyGuyMayor does this fix the problem? If so, please make a PR and I'll merge in your changes.

KyGuyMayor commented 2 years ago

Sorry for the super late reply. I no longer have access to the project that was using this due to a job change. So I am unable to properly test it. I am okay with this being closed.