Context menu not working with datatable after sorting or filtering
Context menu not working with datatable after sorting or filtering
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
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.