Is it possible to use Blfrtip dom with Editor . i am getting only Blfrtip buttons, not Editor botton
Is it possible to use Blfrtip dom with Editor . i am getting only Blfrtip buttons, not Editor botton
latheefp
Posts: 10Questions: 2Answers: 0
var editor;
$(function () {
var table= $('#tblusers').DataTable({
"ajax": {
"url": "/users/getdata",
// "type": "GET",
![](https://datatables.net/forums/uploads/editor/eq/aukysodo5whp.jpg "")
},
"stateSave": true,
"aLengthMenu": [[5, 10, 15, 25, 50, 100 ], [5, 10, 15, 25, 50, 100]],
"processing": true,
"serverSide": true,
"pageLength": 25,
scrollY: "300px",
// scrollX: true,
scrollCollapse: true,
select: true,
// fixedColumns: true,
dom: 'Blfrtip',
buttons: [
{
extend: 'copyHtml5',
exportOptions: {
columns: [ ':visible' ]
}
},
{
extend: 'excelHtml5',
exportOptions: {
columns: ':visible'
}
},
{
extend: 'pdfHtml5',
exportOptions: {
columns: [ ':visible' ]
}
},
{
extend: 'csvHtml5',
exportOptions: {
columns: [ ':visible' ]
}
},
'colvis',
],
"columns": [
{"data":"User Name", "name":"username", "width":"20%","searchable":true},
{"data":"Email", "name":"email", "width":"20%","searchable":true},
{"data":"Logins", "name":"login_count", "width":"10%","searchable":true},
{"data":"Created", "name":"created", "width":"10%","searchable":true},
{"data":"Last Login", "name":"last_login", "width":"20%","searchable":true},
{"data":"Active", "name":"active", "width":"10%","searchable":true},
{"data":"Phone", "name":"phone", "width":"10%","searchable":true},
{
"data": null,
"sortable": false,
"searchable": false,
"orderable": false,
"targets": 0 ,
'printable':false,
'exportable':false,
"render": function(data, type, full) {
return ' <div class="dropdown"> <button type="button" class="btn btn-secondary btn-sm dropdown-toggle" data-toggle="dropdown">Action</button> <div class="dropdown-menu"> <a name="edit" class="dropdown-item" href="#"><i class="fas fa-edit"> </i> Edit</a> <a name="delete" class="dropdown-item" href="#"><i class="fas fa-trash"> </i> Delete</a> </div></div>';
}
},
],
}); //End of dT.
//https://editor.datatables.net/examples/styling/bootstrap
editor = new $.fn.dataTable.Editor( {
ajax: "../php/staff.php",
table: "#tblusers",
fields: [ {
label: "Username:",
name: "username"
}, {
label: "Email:",
name: "email"
}, {
label: "Phone:",
name: "phone"
}
]
} );
// Display the buttons
new $.fn.dataTable.Buttons( table, [
{ extend: "create", editor: editor },
{ extend: "edit", editor: editor },
{ extend: "remove", editor: editor }
] );
table.buttons().container()
.appendTo( $('.col-md-6:eq(0)', table.table().container() ) );
This discussion has been closed.
Answers
You are trying to instantiate the buttons in. two different ways. You need to combine them. Either combine all of the buttons in the
buttons
option in line 21 or combine them all in the function in line 93.Kevin
thank you, i will try this and get back to you. Great help. Quick reply.
yes.. worked. thanks.