Context menu not working with datatable after sorting or filtering

Context menu not working with datatable after sorting or filtering

jayantjayant Posts: 2Questions: 1Answers: 0

when the datatatable is load for the first time , i am able to select the context menu ,but when i apply any filter or sorting or pagination after that contextmenu is not working

Here is my code

$('#example').dataTable();

$('#example td:nth-child(2),td:nth-child(3),td:nth-child(4),td:nth-child(5)').contextPopup({
title: 'Select State',
items: [
{label:'state1', icon:'media/icons/pqq5.png', action:function() { saveState(); } },
{label:'state2', icon:'media/icons/correct3.png', action:function() { saveState(); } },
{label:'state3', icon:'media/icons/abs1.png', action:function() { saveState(); } }
]
});

what i have to so it will work after apply filter and pagination
Thanks

Answers

  • john_ljohn_l Posts: 45Questions: 0Answers: 12

    If you have pagination enabled, then only the rows on the displayed page are in the page/DOM, so you are only applying the context menu to the rows on the first page.

    Try adding a createdRow callback into the initialization options, and set up the context menu for the row in there - that way it'll be added for new rows whenever the user changes page.

This discussion has been closed.