I am using a custom control of datatables.net.
Hi i need to fill the datatable on click of a button.
this is the code that i have written on Load of the form
$('#dtlist').dataTable({
"bPaginate": false,
"bFilter": false,
"bServerSide": true,
"bSort": true,
"sAjaxSource": 'AjaxProcess.aspx?opt=getJsondata',
"fnServerData": function (sSource, aoData, fnCallback) {
aoData.push({ "name": "country", "value": _Country }, { "name": "country", "value": _Country }, { "name": "city", "value": _City });
$.ajax({
"dataType": 'json',
"type": "POST",
"url": sSource,
"data": aoData,
"success": fnCallback
});
}
});
The above code fills the data with below option
Id First Name Last Name Location Country
1 Raj Kumar Andheri India
2 Rajesh Yadav Juhu India
Showing 1 to 2 of 12 entries
Now i hava button on the from where the data is shown. On click of the button i need to get data from the server and re-set it by clearing the existing data.
Below is the function that i have called on Button click
function FillTable() {
var iCountry = 0;
var iCityList = 0;
if ($("#CountryList").html() != "")
iCountry = $("#CountryList").val();
if ($("#CityList").html() != "")
iCityList = $("#CityList").val();
var oTable;
oTable = $('#dtlist').dataTable();
oTable.push({ "name": "Country", "value": _Country }, { "name": "City", "value": iCityList });
oTable.fnDraw(true);
}
Please help it is urgent