fnColReorderCallback is not called

fnColReorderCallback is not called

AzzuAzzu Posts: 8Questions: 0Answers: 0
edited January 2013 in Bug reports
(First, sorry for my English if it's bad, I'm French ^_^)

Hi, the fnColReorderCallback is not called when a column has been moved.
I'm using :
jquery-1.8.3
Datatables 1.9.4
ColReorder 1.0.8

And others plugins/extras :
FixedHeader 2.0.6
ColVis 1.0.8
TableTools 2.1.4
ZeroClipboard 1.0.4

I tried with all the nightly releases, no difference.
However with a modified release of the 1.0.3, it works (without touching the following code).

[code]var oTable = $('#example').dataTable( {
"oColReorder": {
"aiOrder": colOrder,
"fnColReorderCallback": function() {
alert("fnColReorderCallback");

}
});[/code]

Has anyone the same issue or I should double check my code again ?

Replies

  • AzzuAzzu Posts: 8Questions: 0Answers: 0
    anyone ?
  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    I just had a look at the ColReorder code, and there is no `fnColReorderCallback` option. It also is not mentioned in the documentation: http://datatables.net/extras/colreorder/options . What made you think there was one?

    There is an event called `column-reorder` which you could listen for - that will basically do the same thing.

    Allan
  • AzzuAzzu Posts: 8Questions: 0Answers: 0
    edited January 2013
    Thank you for your anwser Allan :)
    I found the callback function here : http://datatables.net/extras/colreorder/api,
    but it is no impossible that i misunderstood something.

    However the event "column-reorder" doesn't seem to work.... Am I using it right ?
    [code]var oTable = $('#example').dataTable( {
    "oColReorder": {"column-reorder": function() {
    alert("hi");
    }
    });[/code]
  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    Oh my - I'm sorry. You are right - it should actually work. I got a bit confused (and the documentation for that parameter is in the wrong place! darn!).

    Let me look into it and get back to you shortly.

    Allan
  • allanallan Posts: 63,687Questions: 1Answers: 10,500 Site admin
    Okay - got it now. There are a couple of things wrong with your little code snippet there:

    1. The callback option is `fnReorderCallback` - not fnColReorderCallback.
    2. You weren't actually initialising ColReorder there, as there is no `R` option in sDom.

    This is what you what your initialisation to look like:

    [code]
    var oTable = $('#example').dataTable( {
    "sDom": 'Rlfrtip',
    "oColReorder": {
    "aiOrder": colOrder,
    "fnReorderCallback": function() {
    alert("fnReorderCallback");
    }
    }
    } );
    [/code]

    I've updated the documentation to put the callback into the initialisation options, where it should be :-).

    Regards,
    Allan
  • AzzuAzzu Posts: 8Questions: 0Answers: 0
    Thank you Allan, it works :D
    I wasn't using the good name ! "fnColReorderCallBack" was the name in my old release (ColReorderWithResize 1.0.3) and I didn't notice the difference...
This discussion has been closed.