Dynamically set customized columns order support in ColReorder

Dynamically set customized columns order support in ColReorder

chentao1006chentao1006 Posts: 4Questions: 0Answers: 0
edited February 2012 in General
I just added following code into ColReorder.js so I can dynamically set columns order as I wish.

[code]
ColReorder.prototype = {
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Public methods
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
.............

"fnSetOrder": function ( a )
{
var resort = fnInvertKeyValues( a )
this._fnOrderColumns( resort );
},

.............

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Static functions
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

ColReorder.fnSetOrder = function ( oTable, a )
{
for ( var i=0, iLen=ColReorder.aoInstances.length ; i

Replies

  • chentao1006chentao1006 Posts: 4Questions: 0Answers: 0
    Forgot to thank Allan for this awesome plug-in!
  • allanallan Posts: 63,542Questions: 1Answers: 10,476 Site admin
    I like it - nice enhancement! I'll include this in the next ColReorder revision if that's okay? :-)

    Allan
  • chentao1006chentao1006 Posts: 4Questions: 0Answers: 0
    Hi, Allan

    Of course okay!
    Thanks again!

    Tao
  • scriptmonkeyscriptmonkey Posts: 6Questions: 2Answers: 0
    Fantastic update, fixed my issue perfectly. I know have a Select list that can dynamically change the column ordering for pre defined views.

    2 Lines of code after the script change.

    ColReorder.fnReset(dataTable);
    ColReorder.fnSetOrder(dataTable, colOrder);
This discussion has been closed.