Datatables refresh
Datatables refresh
I am using the following code to retrieve data from a database and populate a table;
var buid=$('#BU').val();
var htable = $('#hourstable').dataTable({
'bProcessing': true,
'bServerSide': true,
'sAjaxSource': 'fetchtable.asp?action=get&buid=' + buid+'&weekendingdate='+$("#weekendingdate").val(),
'columns': [
{ sTitle: "name", data: "name" },
{ sTitle: "monday", data: "monday" },
{ sTitle: "tuesday", data: "tuesday"},
{ sTitle: "wednewday", data: "wednewday" },
{ sTitle: "thursday", data: "thursday" },
{ sTitle: "friday", data: "friday" },
{ sTitle: "saturday", data: "saturday" },
{ sTitle: "sunday", data: "sunday" },
{ sTitle: "holiday", data: "holiday" },
{ sTitle: "sickness", data: "sickness" },
{ data: "id",classname:"never"}
],
aoColumns: [ { "bVisible": false} , null, null, null, null, null, null, null, null, null, null ]
}).makeEditable({
sUpdateURL: 'fetchtable.asp?action=update',
type: "POST",
async: true,
data: { buid:$("#BU").val(), weekendingdate:$("#weekendingdate").val()},
which works fine. On the same page I have a select box where #BU is selected, I am trying
$('#BU').change(function(){
var buid=$('#BU').val();
alert(buid);
htable.fnDraw();
});
to update the table when the user selects a different value. The alert shows the change, but the chrome console shows the call with exactly the same parameter as the original call as follows
XHR finished loading: GET "http://localhost/lmdqoffice/fetchtable.asp?action=get&buid=5&weekendingdate…7=true&bSortable_8=true&bSortable_9=true&bSortable_10=true&_=1424953849212".
jquery-1.10.2.min.js:6
XHR finished loading: GET "http://localhost/lmdqoffice/fetchtable.asp?action=get&buid=5&weekendingdate…7=true&bSortable_8=true&bSortable_9=true&bSortable_10=true&_=1424953849213".
Is there something I am missing to refresh a table?
Many thanks
Pete