callback for ColReorder plugin

callback for ColReorder plugin

cbattarelcbattarel Posts: 14Questions: 0Answers: 0
edited July 2011 in General
Hello and thanks for this great tool.
I've implemented a callback for the ColReorder plugin because i have to execute some code after a column has been moved.
I don't know where i can post my code, so here it is (based on th ColReorder 1.0.3) at the end of _fnMouseUp function :
[code]
/* callback */
if ( this.s.init.fnColReorderCallback )
{
this.s.init.fnColReorderCallback.call();
}
[/code]

To use this functionnality, define the function in the datatables init, like this :
[code]
$(document).ready(function() {

/*
* Initialse DataTables
*/
oTable = $('#resume').dataTable( {
/* ... */
"oColReorder": {
"iFixedColumns": 1,
"fnColReorderCallback": function() {
}
},
/* ... */
});

} );
[/code]

Replies

  • josemotajosemota Posts: 17Questions: 0Answers: 0
    edited August 2011
    That is awesome, I will try and inject this as well. Has this feature been included by default?
  • allanallan Posts: 63,530Questions: 1Answers: 10,473 Site admin
    No it hasn't been - but it does sound like a good idea. Made a note to myself to do so for the next version!

    Thanks,
    Allan
  • allanallan Posts: 63,530Questions: 1Answers: 10,473 Site admin
    I've just committed this into ColReorder (the initialisation option is called "fnReorderCallback", but otherwise almost identical to cbattarel's suggestion). This will be included in the next release of ColReorder, and until then it is available in the nightly, which is available on the download page: http://datatables.net/download .

    Regards,
    Allan
This discussion has been closed.