Laravel Datatables ContextMenu
Bash:
npm install jquery-contextmenu
app.scss
//ContextMenu
@import '~jquery-contextmenu/src/sass/jquery.contextMenu.scss';
bootstrap.js
window.contextMenu = require( 'jquery-contextmenu');
var table = $('#data-table').DataTable({
...
,drawCallback : function() {
$.contextMenu({
selector: 'tbody tr',
callback: function(key, options) {
data = table.row( options.$trigger[0] ).data()
var m = "clicked: " + key + ' ' + data.id;
window.console && console.log(m);
},
items: {
"edit": {name: "Edit", icon: "edit"},
copy: {name: "Copy", icon: "copy"},
"delete": {name: "Delete", icon: "delete"},
"sep1": "---------",
"quit": {name: "Quit", icon: function(){
return 'context-menu-icon context-menu-icon-quit';
}}
}
});
},
npm run dev
({{pro_count}})
Beitrag bewerten:{{percentage}} % positiv
({{con_count}})