var TableDatatablesButtons=function(){var initTable1=function(){var table=$('#sample_1');var oTable=table.dataTable({bPaginate:false,bFilter:false,bInfo:false,bSort:false,"language":{"aria":{"sortAscending":": activate to sort column ascending","sortDescending":": activate to sort column descending"},"emptyTable":messages.nodata_available,"info":"Showing _START_ to _END_ of _TOTAL_ entries","infoEmpty":"No entries found","infoFiltered":"(filtered1 from _MAX_ total entries)","lengthMenu":"_MENU_ entries","search":"Search:","zeroRecords":"No matching records found"},buttons:[],responsive:true,"order":[[0,'asc']],"lengthMenu":[[5,10,15,20,-1],[5,10,15,20,"All"]],"pageLength":10,"dom":"<'table-scrollable't>",});}
var initTable1_2=function(){var table=$('#sample_1_2');var oTable=table.dataTable({bPaginate:false,bFilter:false,bInfo:false,bSort:false,"language":{"aria":{"sortAscending":": activate to sort column ascending","sortDescending":": activate to sort column descending"},"emptyTable":messages.nodata_available,"info":"Showing _START_ to _END_ of _TOTAL_ entries","infoEmpty":"No entries found","infoFiltered":"(filtered1 from _MAX_ total entries)","lengthMenu":"_MENU_ entries","search":"Search:","zeroRecords":"No matching records found"},buttons:[],responsive:true,"order":[[0,'asc']],"lengthMenu":[[5,10,15,20,-1],[5,10,15,20,"All"]],"pageLength":10,"dom":"<'table-scrollable't>",});}
var initTable2=function(){var table=$('#sample_2');var oTable=table.dataTable({"language":{"aria":{"sortAscending":": activate to sort column ascending","sortDescending":": activate to sort column descending"},"emptyTable":"No data available in table","info":"Showing _START_ to _END_ of _TOTAL_ entries","infoEmpty":"No entries found","infoFiltered":"(filtered1 from _MAX_ total entries)","lengthMenu":"_MENU_ entries","search":"Search:","zeroRecords":"No matching records found"},buttons:[{extend:'print',className:'btn default'},{extend:'copy',className:'btn default'},{extend:'pdf',className:'btn default'},{extend:'excel',className:'btn default'},{extend:'csv',className:'btn default'},{text:'Reload',className:'btn default',action:function(e,dt,node,config){alert('Custom Button');}}],"order":[[0,'asc']],"lengthMenu":[[5,10,15,20,-1],[5,10,15,20,"All"]],"pageLength":10,"dom":"<'row' <'col-md-12'B>><'row'<'col-md-6 col-sm-12'l><'col-md-6 col-sm-12'f>r><'table-scrollable't><'row'<'col-md-5 col-sm-12'i><'col-md-7 col-sm-12'p>>",});}
var initTable3=function(){var table=$('#sample_3');var oTable=table.dataTable({"language":{"aria":{"sortAscending":": activate to sort column ascending","sortDescending":": activate to sort column descending"},"emptyTable":"No data available in table","info":"Showing _START_ to _END_ of _TOTAL_ entries","infoEmpty":"No entries found","infoFiltered":"(filtered1 from _MAX_ total entries)","lengthMenu":"_MENU_ entries","search":"Search:","zeroRecords":"No matching records found"},buttons:[{extend:'print',className:'btn dark btn-outline'},{extend:'copy',className:'btn red btn-outline'},{extend:'pdf',className:'btn green btn-outline'},{extend:'excel',className:'btn yellow btn-outline '},{extend:'csv',className:'btn purple btn-outline '},{extend:'colvis',className:'btn dark btn-outline',text:'Columns'}],responsive:true,"order":[[0,'asc']],"lengthMenu":[[5,10,15,20,-1],[5,10,15,20,"All"]],"pageLength":10,});$('#sample_3_tools > li > a.tool-action').on('click',function(){var action=$(this).attr('data-action');oTable.DataTable().button(action).trigger();});}
var initAjaxDatatables=function(){$('.date-picker').datepicker({rtl:App.isRTL(),autoclose:true});var grid=new Datatable();grid.init({src:$("#datatable_ajax"),onSuccess:function(grid,response){},onError:function(grid){},onDataLoad:function(grid){},loadingMessage:'Loading...',dataTable:{"bStateSave":true,"lengthMenu":[[10,20,50,100,150,-1],[10,20,50,100,150,"All"]],"pageLength":10,"ajax":{"url":"../demo/table_ajax.php",},"order":[[1,"asc"]],buttons:[{extend:'print',className:'btn default'},{extend:'copy',className:'btn default'},{extend:'pdf',className:'btn default'},{extend:'excel',className:'btn default'},{extend:'csv',className:'btn default'},{text:'Reload',className:'btn default',action:function(e,dt,node,config){dt.ajax.reload();alert('Datatable reloaded!');}}],}});grid.getTableWrapper().on('click','.table-group-action-submit',function(e){e.preventDefault();var action=$(".table-group-action-input",grid.getTableWrapper());if(action.val()!=""&&grid.getSelectedRowsCount()>0){grid.setAjaxParam("customActionType","group_action");grid.setAjaxParam("customActionName",action.val());grid.setAjaxParam("id",grid.getSelectedRows());grid.getDataTable().ajax.reload();grid.clearAjaxParams();}else if(action.val()==""){App.alert({type:'danger',icon:'warning',message:'Please select an action',container:grid.getTableWrapper(),place:'prepend'});}else if(grid.getSelectedRowsCount()===0){App.alert({type:'danger',icon:'warning',message:'No record selected',container:grid.getTableWrapper(),place:'prepend'});}});$('#datatable_ajax_tools > li > a.tool-action').on('click',function(){var action=$(this).attr('data-action');grid.getDataTable().button(action).trigger();});}
return{init:function(){if(!jQuery().dataTable){return;}
initTable1();initTable1_2();initTable2();initTable3();initAjaxDatatables();}};}();jQuery(document).ready(function(){TableDatatablesButtons.init();});