How to put a condition to check if data not null then "Not Found" button will appear, otherwise it will be hidden. Assuming client side received Ajax response from API.
success: function(response){
var result;
if (response.data != null){
result = "dataNotNull";
} else {
result = "dataNull";
}
loadFunc(result);
}
function loadFunc(result){
$('#myTable').DataTable({
buttons: [
{
text: 'Missmatch',
titleAttr: 'Download in Excel',
action: function ( e, dt, node, config ) {
func_expMissMatch();
}
},
{
text: 'Not Found',
titleAttr: 'Download in Excel',
action: function ( e, dt, node, config ) {
func_expNotFound();
}
}
]
});
}
2
Answers
try this:
In Boostrap, you can hide the button with
Where
#my-button
needs to be theid
of the button element.So…
Hide twitter bootstrap button