Bug in Select extension

Bug in Select extension

modulusOperatormodulusOperator Posts: 7Questions: 0Answers: 1

It seems there may be a bug in the Select extension v1.0.1 at line 308. 'triggerHandler( )' is used rather than 'trigger( )', causing the 'select.dt' event (and other Select events) to not bubble and be available outside of the target element. Of course I could be wrong and this could be intentional but I assume this is supposed to bubble because of the '.dt' namespace appended to the event type and the fact that trigger is used elsewhere to allow bubbling.
So to summarize, I believe that

$(api.table().node()).triggerHandler( type+'.dt', args );

should be

$(api.table().node()).trigger( type+'.dt', args );

Replies

  • modulusOperatormodulusOperator Posts: 7Questions: 0Answers: 1
    edited September 2015

    ..

  • allanallan Posts: 61,609Questions: 1Answers: 10,088 Site admin

    Actually, this was intended. I didn't see any benefit in having this event bubble up the DOM and it would hurt performance if a lot of events were triggered.

    Do you have a use for it bubbling?

    Allan

  • modulusOperatormodulusOperator Posts: 7Questions: 0Answers: 1

    My use is to have a table toolbar slide into view whenever a checkbox is checked on any datatable. I could just use the click event from the className assigned to the checkboxes. Although the documentation https://datatables.net/reference/event/select doesn't explicitly say that it is supposed to bubble it seemed as if the 'select.dt' and 'deselect.dt' events were supposed to bubble like 'draw.dt' and 'destroy.dt' within the '.dt' namespace. The documentation mentions that in the case of mulitple items selected in a single action the event only firing once with information about the selected items conveyed with the event. Thank you for taking the time to review this.

  • allanallan Posts: 61,609Questions: 1Answers: 10,088 Site admin

    Bubbling and cancellablity are two aspects of the events that DataTables and its extensions emit that I need to review in detail and then document. You are correct that most events DataTables itself currently emits will bubble, but that might not be retained in future versions. Likewise draw, init and destroy will bubble as that is useful, not I'm not sure that the others are. I also want to limit the bubbling so they won't cause performance issues.

    Thanks for bringing this up.

    Allan

This discussion has been closed.