Buttons with show/hide rows
Buttons with show/hide rows
installman
Posts: 2Questions: 2Answers: 0
Hello,
I am new in js programming and use datatables for my page.
Actually I use Bootstrap style and was able to add the button in one row with length and search fields.
Now I want to implement the function for the button, where I want to "show/hide disabled" items (rows).
How to implement that?
Here my code snipset:
var table = $('#spending').DataTable({
"sDom": "<'row'<'col-sm-12 col-md-2'B><'col-sm-12 col-md-2'l><'col-sm-12 col-md-8'f>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row'<'col-sm-12 col-md-5'i><'col-sm-12 col-md-7'p>>",
buttons: [
{
text: 'Show Disabled',
// what to do here ....
}
],
lengthMenu: [[25, 50, -1], [25, 50, "All"]],
stateSave: true,
select: true
});
...
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You would use the
buttons.buttons.action
like this example. In the function I would probably use a Search API to show/hide the "disabled" items. This example may help you get started:http://live.datatables.net/ciyalayo/1/edit
Note that is looks for a checkbox to determine whether to hide or show the rows. You will likely do something similar as a flag to determine whether to show or hide disabled items.
Please post any questions. Or better create a simple test case or update mine so that we can look at to help you.
https://datatables.net/manual/tech-notes/10#How-to-provide-a-test-case
HTH,
Kevin