print validation
print validation
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.
Answers
Try returning false from your function or use
stopPropagation()
.Allan
allan still the function gets continue no changes.
Can you link to an example showing the issue so I can take a look into it please?
Thanks,
Allan
Oh - it might also be worth adding
return false;
into your event handler.Allan
$.noConflict;
documentObj = jQuery(document);
document.oncontextmenu = function() {return false;};
documentObj.ready(function(){
jQuery.fn.dataTable.Buttons.swfPath = 'https://mybus.esy.es/plugins/datatables/export/flashExport.swf';
var table = jQuery('#datatable-responsive').DataTable( {
dom: 'Bfrtip',
responsive: true,
bLengthChange :true,
select :true,
ajax: {
url: '../modal/ClientContacts.php',
dataSrc: 'aaData',
method:'POST'
},
buttons: [
'pageLength',
});
when i click on pdf button it should accept and work only when row is selected
If you link to a test case showing the issue, I'd be happy to take a look into it.
Allan
in the picture when i click on a pdf button and when no rows are selected it should show message as please select the row.But here the pop up alert message is showing but the function pdf is working at same time.it should not work when no ows are selected
Allan asked for a link to a test case.