Not returning data for rows after first page

Not returning data for rows after first page

jguzmanhenaojguzmanhenao Posts: 2Questions: 1Answers: 0

Hi there, I have a datatable with a button on each row to edit that row data in a modal, it works fine when I click any of the rows in the first page, however, it does not retrieve any data for the rows of the second page or after. I tried showing all rows and even removing pagination, but the same issue happens after row #25. any advice is appreciated.

Answers

  • jguzmanhenaojguzmanhenao Posts: 2Questions: 1Answers: 0

    Got it figured out...

    Cause:
    After the table is initialized, only visible rows exist in Document Object Model (DOM). According to jQuery on() documentation.

    Solution:
    Use event delegation by providing selector for target element as a second argument in on() call, see example below. According to jQuery on() documentation.

    $('#example').on('click', '.btn-edit', function(){
    // ...
    });

Sign In or Register to comment.