DataTables page 2 of pagination not calling Magnific Popup

前端 未结 1 1154
长情又很酷
长情又很酷 2021-01-26 07:01

So I have this DataTable with pagination enabled which I coded a way so the user can edit lines of a table, when the user calls the edit page it opens in a Magnific Popup, it al

相关标签:
1条回答
  • 2021-01-26 07:32

    CAUSE

    Only first page elements are available in DOM, that is why your jQuery selector $('.popup-ajax') doesn't select elements from pages other than first.

    SOLUTION

    You need to initialize Magnific Popup inside callback defined by drawCallback option. This function will be called every time the table has been redrawn.

    For example:

    var table = $('#example').DataTable({
       // ... skipped ...
       drawCallback: function(){
          $('.popup-ajax').magnificPopup({
             type: 'ajax',
             showCloseBtn: 'true',
             modal: 'true'
          });
       }
    });
    

    LINKS

    See jQuery DataTables: Custom control does not work on second page and after for more examples and details.

    0 讨论(0)
提交回复
热议问题