Reputation: 2434
I have a DataTables table defined like this:
$(function () {
var yadcf_data_3;
var oTable = $('#example').DataTable({
"serverSide": true,
"ajax": {"url": "/platform/elements/?format=datatables",
"dataSrc": function(json){
yadcf_data_3 = json.options.yadcf_data_3
//this line returns the appropriate list of values
console.log(yadcf_data_3)
return json.data;
}
}
});
//this line returns undefined
console.log(yadcf_data_3)
//other stuff
yadcf.exRefreshColumnFilterWithDataProp(oTable, 3, yadcf_data_3);
});
How do I use yadcf_data_3
to populate a filter for the table? yadcf_data_3
returns undefined outside of the oTable
variable.
Upvotes: -1
Views: 152
Reputation: 1
var table = $("#employeetable").DataTable({
"ajax": {
"url": "/url",
"type": "POST",
"datatype": "json"
, dataSrc: function (data) {
CalculateSum= data.CalculateSum;
return data.data;
}
}
....
drawCallback: function (settings) {
var api = this.api();
$('#CalculateSum').html(CalculateSum);
},
"serverSide": "true",
"order": [0, "desc"],
Upvotes: 0