print button validation

print button validation

manjeshmanjesh Posts: 6Questions: 1Answers: 0

hi,
i have been trying with the below code,
{
extend: 'print',
text: 'Print selected',
exportOptions: {
modifier: {
selected: true
}
}
}
i have been trying like when i click on the button it should check if the rows have been selected or not.If no rows been selected it should show message saying please select the row.The problem is when we click it shows pop up as i used this below code
jQuery('.buttons-print').on('click', function () {
var datas = table.rows('.selected').ids().toArray();
if(datas==''|| datas==undefined){
jQuery.jGrowl("Please select a invoice.", { header: 'select row',theme:'bg-blue-alt' });
}
it shows pop up but continue the print function.I want to stop the function.
please help.

This discussion has been closed.