As previously announced via banners and our newsletters, support is no longer available through this platform.

For easier navigation, you can still click on "Submit a Ticket" here, choose the appropriate category, and you'll be redirected to the correct support channel for your plugin.

You can still access your previous tickets and browse public tickets, but please note that responding to tickets is no longer possible.

Paid customers: Please log in to your store account for support.

Pre-purchase questions: Use the support widget in the bottom-right corner of our websites:
https://wpamelia.com
https://wpdatatables.com
https://wpreportbuilder.com

Okay
  Public Ticket #2408116
datatables events
Closed

Comments

  •  2
    Duncan started the conversation

    I am unable to catch the javascript "select" event of datatables.js
    i.e. (https://datatables.net/reference/event/select)

    I am trying to insert the code into your "Custom wpDataTables JS" section.

    By the way, the 'order' event does work but is not the event I need.

    I am using the following code:

    jQuery(window).load(function(){
      //wpDataTables.table_1.addOnDrawCallback(function(){alert('Callback triggered!');});
      var table = jQuery('#table_1').DataTable();
      table.on( 'select', function ( e, dt, type, indexes ) {
      alert( 'Table select ran!' );
      if ( type === 'row' ) {
        var data = table.rows( indexes ).data().pluck( 'id' );
        // do something with the ID of the selected items
        alert(id);
      }
      });
    });


  •  2
    Duncan replied

    This seems to work, it is different to the datatables.net advice but it works:
    (I placed it once in the correct page as a snippet, if placed in the wp data tables custom JS section, it is inserted for every single table)

    jQuery(window).load(function(){

      var table = jQuery('#table_1').DataTable();

      jQuery('#table_1 tbody').on('click', 'tr', function () {
        var data = table.row( this ).data();
        alert(data[0]);
      });
      
    });


  •  472
    Isidora replied

    Hi Duncan,
    Thank you for your purchase.

    I am glad that you found a solution.

    Previous code is not working because we override that event, and we made custom clickEvent function for our needs.

    Kind Regards, 

    Isidora Markovic

    wpDataTables: FAQFacebookTwitterFront-end and back-end demoDocs

    Amelia: FAQFacebookTwitter |  Amelia demo sites | Docs

    You can try our wpDataTables add-ons before purchase on these sandbox sites:

    Powerful FiltersGravity Forms Integration for wpDataTablesFormidable Forms Integration for wpDataTables