ColReorder:reorderCallback not called when ordered with fnOrder API

ColReorder:reorderCallback not called when ordered with fnOrder API

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

Hi,
I noticed that when we use fnOrder API,reorderCallback is not triggered. I think it should trigger reorderCallback when ordering is done with API as well.

table.colReorder.fnOrder([0, 1, 3, 4, 5, 2, 6, 7]);
// does not trigger  reorderCallback  

This question has an accepted answers - jump to answer

Answers

  • c0okiemonsterc0okiemonster Posts: 2Questions: 0Answers: 0

    I'm having the exact same issue. I can confirm that fnOrder does not trigger the reorderCallback. I'm giving users the option to change column order through drag drop as well as using a dialog. The reorderCallback should be called in both instances.

  • babablacksheepbabablacksheep Posts: 41Questions: 23Answers: 0
    edited March 2015

    @c0okiemonster : For the moment u can manually trigger reorderCallback i guess

  • c0okiemonsterc0okiemonster Posts: 2Questions: 0Answers: 0

    @babablacksheep : If you add a call to the namespace callbacks from the fnOrder function, it will call the fnReorderCallback function just as it does in the mouseup function

    "fnOrder": function ( set )
        {
            if ( set === undefined )
            {
                var a = [];
                for ( var i=0, iLen=this.s.dt.aoColumns.length ; i<iLen ; i++ )
                {
                    a.push( this.s.dt.aoColumns[i]._ColReorder_iOrigCol );
                }
                return a;
            }
    
            this._fnOrderColumns( fnInvertKeyValues( set ) );
    
            //add the code below to replicate the callback call made in the mouseup function
            if ( this.s.dropCallback !== null )
            {
                this.s.dropCallback.call( this );
            }
            //custom code ends here
            
            return this;
        },
    
  • allanallan Posts: 61,814Questions: 1Answers: 10,123 Site admin
    Answer ✓

    Completely agree - thanks for letting me know about this (and sorry for missing it originally).

    Fix committed and the nightly is currently rebuilding with the change. It will be included in the next release.

    Regards,
    Allan

This discussion has been closed.