ColReorder 1.0.5 and event management

ColReorder 1.0.5 and event management

DiNastyDiNasty Posts: 5Questions: 0Answers: 0
edited April 2012 in General
Hi everyone,

I've seen a line in ColReorder that stops the propagation of a mousedown event on a th :

[code]
/**
* Add a mouse down listener to a particluar TH element
* @method _fnMouseListener
* @param int i Column index
* @param element nTh TH element clicked on
* @returns void
* @private
*/
"_fnMouseListener": function ( i, nTh )
{
var that = this;
$(nTh).bind( 'mousedown.ColReorder', function (e) {
that._fnMouseDown.call(that, e, nTh);
return false;
} );
},
[/code]

Return false == Prevent Default & Stop Propagation.

Since this behavior do only happen using ColReorder plugin, my question is :

Why is there a return false on that function, because i need that event to bubble and not be stopped.
So, I've commented that line out recently but I was wondering if it was there for a huge purpose :)

I don't wanna break anything so,
Can anyone tell me if it's mandatory or not ?

Regards,

Replies

  • allanallan Posts: 63,810Questions: 1Answers: 10,516 Site admin
    I can't honestly think why I put return false rather than e.preventDefault() - probably just being daft at the time... I've just committed a change which uses preventDefault to stop the default action (focusing the element) which can be picked up from the ColReorder nightly on the downloads page: http://datatables.net/download .

    Regards,
    Allan
  • DiNastyDiNasty Posts: 5Questions: 0Answers: 0
    Hi Allan,

    Thanks very much for your really quick answer.

    Exactly what I needed to hear ;)

    Have a good day!
This discussion has been closed.