reload data on button click when using pipelining
reload data on button click when using pipelining
dehian
Posts: 3Questions: 0Answers: 0
Hi,
could someone tell me how to reload data of the datatable on click of a button when using pipelining?
i tried
fnDraw() (which don't do anything)
clearPipeline().draw() (which gives me an error)
Thanks for your help
This discussion has been closed.
Replies
If it helps, here's some sample code i use for the datatable
var table =$('#dataTbl').dataTable({
"columnDefs": [ {
"targets": 2,
"searchable": false,
"sortable":false,
"fnCreatedCell": function(nTd, sData, oData, iRow, iCol){
$(nTd).css('text-align', 'center');
},
"mData": null,
"mRender": function( data, type, full) {
return '<td><a href="editPurchase.php?purchaseid='+data.id+'"><span class="glyphicon glyphicon-edit"></span></a></td>';
}
} ],
"columns": [null,{ "width": "5%","text-align":"center" }],
"pageLength":10,
"searching": false,
"lengthChange":true,
"processing": true,
"serverSide": true,
"deferRender": true,
"ajax": $.fn.dataTable.pipeline( {
url: 'getPurchaseList.php',
pages: 5,
method: 'POST',
"data": function ( d ) {
d.clientid = $('#clientid').val();
d.clientname = $('#clientname').val();
}
} ),
"columns": [
{ "data": "id" },
{ "data": "clientname" } ]
});
so what i want to do is to be able to refresh de datatable when some fields not directly related to the datatable are changed (clientid, clientname,.. in an upper search form) or when someone clicks on a button.
could someone help me on this?
nevermind i found the solution.
i had to used
table.api().clearPipeline().draw()
instead of
table.clearPipeline().draw()
topic can be closed