$(document).ready(function() { var oTableTaskLst = $('#tblTaskLst').DataTable({ "processing": true, "serverSide": true, 'responsive': true, 'destroy' : true, "columns": [ { "data": "status", "orderable" : false, "render": function ( data, type, row ) { var status = "-"; if(data) { status = "" + data.statusDesc + ""; } return status; } }, { "data": "taskMasterId" }, { "data": "appDate" }, { "data": "applicant" }, { "data": "type.description" }, { "data": null, className: 'td-actions text-right', "orderable" : false, "render": function ( data, type, row ) { console.log(data); var buttons = action.viewButton; return buttons; } }, ], "ajax": $.fn.dataTable.pipeline({ "pages" : 1, "type" : "GET", "url": contextPath + "/tasks/history/paginated", "action": 'xhttp', "cache": false, 'beforeSend': dtRequestHeader, 'dataType': 'json', "dataSrc": dtDataSrc, "data": function ( data ) { data.taskMasterId = $("#taskMasterId").val(); data.statusId = $('#status').find(":selected").val(); data.history = true; }, "error": function(){ // error handling console.log("error"); } }), "initComplete": function(settings, json) { $('input#taskMasterId').unbind(); $('input#status').unbind(); $('#searchFilter').bind('click', function(e) { portalUtil.showMainLoading(true); oTableTaskLst .column(1).search($('input#taskMasterId').val()) .column(2).search($('#status').find(":selected").val()) oTableTaskLst.draw(); $(".em-toggle").click(); }); $('#searchClear').bind('click', function(e) { $('input#taskMasterId').val("") $("#status").val("").select2(); oTableTaskLst.columns().search("").draw(); $(".em-toggle").click(); }); }, "fnDrawCallback": function ( oSettings ) { hidePagination(this,"#tblTaskLst"); portalUtil.showMainLoading(false);} }); $('#tblTaskLst').dataTable().fnSetFilteringEnterPress(); $('#tblTaskLst tbody').on( 'click', 'button.view', function () { var d = oTableTaskLst.row( $(this).parents('tr') ).data(); location.href = contextPath + "/tasks/application?id=" + d.taskMasterId; }); });