Add Event to Custom Pane (button.searchPanes Case)

Add Event to Custom Pane (button.searchPanes Case)

SurvilleSurville Posts: 2Questions: 1Answers: 0

Hi,

I take the liberty of appealing to you because I am really stuck on a subject related to the following case : https://live.datatables.net/poqarexu/1/edit

As can be seen, on initialisation (delayInit: false) of the customPane there isn't log about its attached events.
And the click event won't work too.

Could you tell me where i'm wrong ?
Thx

This question has an accepted answers - jump to answer

Answers

  • kthorngrenkthorngren Posts: 22,015Questions: 26Answers: 5,081

    I believe the creation of the event handlers in the Datatables initialization object was introduced in DT 2.3.0. I upgraded the 2.2.2 version you have in the test case to 2.3.0 in this updated test case:
    https://live.datatables.net/poqarexu/2/edit

    Also fixed a typo in delayInit: false,. Now you can see the init event output during initialization.

    And the click event won't work too.

    I haven't found the docs for this new way of creating the events. The feature might be limited to only Datatables events. Maybe @allan can point us to the docs.

    You have select: { style: 'api' }. I commented this out and now Roger can be selected. What is your goal for using select: { style: 'api' } and creating your own click event?

    The only reference I found for delayInit is this thread. Looks like @allan needs to add this to the SearchPanes docs.

    Kevin

  • kthorngrenkthorngren Posts: 22,015Questions: 26Answers: 5,081
    Answer ✓

    Possibly the solution in this thread will provide the click event you are looking for. I updated the test case to use this delegated event version of the solution presented:

      $(document).on('click', '.dtsp-panesContainer table tr', function() {
        console.log($(this).find('span:first-child').text());
      });
    

    https://live.datatables.net/poqarexu/3/edit

    Kevin

  • SurvilleSurville Posts: 2Questions: 1Answers: 0

    Thank you kevin and my apologies, I didn't pay attention to DT's version and typo when i copy/past the code.

    Unfortunately I couldn't find the documentation but I understood my mistake and the solution works.

    Thanks. Gerald

Sign In or Register to comment.