How to add context menu in datatables 1.10?

I am using DataTables(datatables.net) and I would like to add a context menu to my table.

I found jQuery contextMenu , as well as a description in the forum DataTablesabout how someone implemented the context menu. But it seems that at least DataTableswhich I am currently using (1.10) has evolved quite a lot. I have no information about the plugin Context Menu. (which means which version was used on this forum and what I downloaded).

If I use it, as described in the forum post, and adapt it to 1.10 (to my humble knowledge), I come to this

var myTable = $("#myTable ").DataTable( {
    "drawCallback": function( settings ) {
        $("#myTable tbody tr").contextMenu(
        {
            menu: 'myMenu'},
            function( action, el, pos ) {
                var aData = myTable.GetData( el.context );
            }
        );
    }
} );

But executing this code will give me this error:

Search error: selector not specified in jquery.contextMenu.js: 1273

- DataTable 1.10?

+4
1

, .

jquery.ui-contextmenu: DEMO

jquery.ui, , .

fnFilter() fnFilterClear(), , .

!

UPDATE: DataTables 1.10 API!

fnFilter() fnFilterClear() API search().

DEMO:)

+6

Source: https://habr.com/ru/post/1540960/


All Articles