I am trying to insert three buttons in datatable
I am trying to insert three buttons in datatable
issamy11
Posts: 4Questions: 1Answers: 0
I am trying to insert 3 buttons after id="example_length" and I am stuck
I am using knockout js
<tbody
data-bind="dataTablesForEach: {data: $root.requests, dataTableOptions: {
responsive : true,
'language': {
'search': 'Filter Companies:',
'zeroRecords' : 'No Companies To Display'
},
initComplete : function(){
new $.fn.dataTable.Buttons(table, {
buttons: ['copy', 'excel', 'pdf'] });
table.buttons().container().insertAfter( '#example_filter' );
}
}
}">
This discussion has been closed.
Answers
Thanks for your question - however, per the forum rules can you link to a test case showing the issue please. This will allow the issue to be debugged.
Information on how to create a test page, if you can't provide a link to your own page can be found here.
Thanks,
Allan
Thanks Allan for the quick response
I am trying to use different approach
Thanks Allan for the quick response
I am trying to use different approach
Is syntax is correct?
I am trying to insert a div <#toolbar> after the length. I tried every possible way. I followed the documentation how to insert div with an id and class but in the DOM it only give me a empty div with a lenght label inside it.
Thanks for your help.
I don't know I'm afraid. I'm not too familiar with Knockout. What does the generated HTML look like?
As I say, please link to a test case.
Allan
Thanks Allan https://jsfiddle.net/z4zk9zdz/1/ I think when I try to add some functionality to datatable like buttons, sorting etc I think using $(document).ready(function() {
$('#example').dataTable();
});
makes the data disappear and being not responsive
You need to add the data to the table using the DataTables API -
rows.add()
in this case. At the moment you are adding data without telling DataTables, so it doesn't know that there is any data in the table.There are a number of threads on Knockout support with DataTables - for example. Basically you need to use a custom binding if you want to use it with DataTables.
Allan
Thanks Allan