Checkbox in DataTable header

Checkbox in DataTable header

ParimalParimal Posts: 17Questions: 1Answers: 0
edited July 2012 in General
Hi Allan

I am using Datatable using serverside processing. I have check box into datatable header, but how i can call the function as mention into "fnServerData" configuration.

[code]
$('#dtAdvIndividual').dataTable({
"bStateSave": false,
"bPaginate": true,
"bJQueryUI": true,
"iDisplayLength": $("#sFilterType").val().toLowerCase().startsWith("showall") ? pagingCount : 5,
"iDisplayStart": 0,
"bAutoWidth": false,
"bProcessing": true,
"bDestroy": true,
"bServerSide": true,
"fnInitComplete": function () {
$("#divFullAdvSearchResult").css("height", "auto");
},
"sAjaxSource": "/AdvancedSearch/GetAllIndividuals",
"fnServerData": fnDataTablesPipeline,
"sDom": '<"H"<"#hdrlblIndividual"><"#hdrCurrentMember">fr>t<"F"ip>', // to remove page length
"oLanguage": {
"sSearch": "Filter: ",
"sInfo": "Showing _START_ to _END_ of _TOTAL_ entries" + ($("#sFilterType").val().toLowerCase().startsWith("showall") == false ? $('').wrapInner(" (show all)").html() : "")
},
"aoColumns": [
{
//Status
"bSortable": false,
"sWidth": "40px",
"sClass": "center status norightborder"
},
{
//MemberID
"sWidth": "100px",
"sClass": "recordid noborder"
}
]
}).fnSetFilteringDelay(1000);




function fnDataTablesPipeline(sSource, aoData, fnCallback) {
var iPipe = 5; /* Ajust the pipe size */

var bNeedServer = false;
var sEcho = fnGetKey(aoData, "sEcho");
var iRequestStart = fnGetKey(aoData, "iDisplayStart");
var iRequestLength = fnGetKey(aoData, "iDisplayLength");
var iRequestEnd = iRequestStart + iRequestLength;
oCache.iDisplayStart = iRequestStart;

/* outside pipeline? */
if (oCache.iCacheLower < 0 || iRequestStart < oCache.iCacheLower || iRequestEnd > oCache.iCacheUpper) {
bNeedServer = true;
}

/* sorting etc changed? */
if (oCache.lastRequest && !bNeedServer) {
for (var i = 0, iLen = aoData.length; i < iLen; i++) {
if (aoData[i].name != "iDisplayStart" && aoData[i].name != "iDisplayLength" && aoData[i].name != "sEcho") {
if (aoData[i].value != oCache.lastRequest[i].value) {
bNeedServer = true;
break;
}
}
}
}

/* Store the request for checking next time around */
oCache.lastRequest = aoData.slice();

if (bNeedServer) {
if (iRequestStart < oCache.iCacheLower) {
iRequestStart = iRequestStart - (iRequestLength * (iPipe - 1));
if (iRequestStart < 0) {
iRequestStart = 0;
}
}

oCache.iCacheLower = iRequestStart;
oCache.iCacheUpper = iRequestStart + (iRequestLength * iPipe);
oCache.iDisplayLength = fnGetKey(aoData, "iDisplayLength");
fnSetKey(aoData, "iDisplayStart", iRequestStart);
fnSetKey(aoData, "iDisplayLength", iRequestLength * iPipe);

$.getJSON(sSource, aoData, function (json) {
/* Callback processing */
oCache.lastJson = jQuery.extend(true, {}, json);

if (oCache.iCacheLower != oCache.iDisplayStart) {
json.aaData.splice(0, oCache.iDisplayStart - oCache.iCacheLower);
}
json.aaData.splice(oCache.iDisplayLength, json.aaData.length);
fnCallback(json);
})
.error(function () {
//remove datatable
var errorMessage = $("").html($("#ASErrorMessage").val());
$("[id$='searchresult']").html(errorMessage);
})
.complete(function () {
//remove progress bar
//$("#dtAdvIndividual_processing").hide();
});
}
else {
json = jQuery.extend(true, {}, oCache.lastJson);
json.sEcho = sEcho; /* Update the echo for each response */
json.aaData.splice(0, iRequestStart - oCache.iCacheLower);
json.aaData.splice(iRequestLength, json.aaData.length);
fnCallback(json);
return;
}

$(this).parents(".dataTables_wrapper").find(".ui-corner-tl .dataTables_processing").css("top", "50%");
}



$("#cbCurrentMemner").bind("change", function () {
alert("done");
fnDataTablesPipeline("??????????????????????????????????????");
});

As soon as i have select something into filter box, Datatable is calling fnDataTablesPipeline.
But how i can provide variable into fnDataTablesPipeline on bind event of check box.
This discussion has been closed.