How to change the aaData source dynamically
How to change the aaData source dynamically
Hello,
Am getting my table data as [code] ""aaData":<?php echo json_encode($purchases); ?>,"[/code] . It works great.
Now I want to change the content of Datatable on selection of an option from Select Box(warehouse1(Default)/warehouse2) and generate the table based on the data fetched from sql table(warehouse1/warehouse2/warehouse3) as selected options without refreshing the page.
So how do I do it?? Is it fnReloadAjax or something else ?
Am getting my table data as [code] ""aaData":<?php echo json_encode($purchases); ?>,"[/code] . It works great.
Now I want to change the content of Datatable on selection of an option from Select Box(warehouse1(Default)/warehouse2) and generate the table based on the data fetched from sql table(warehouse1/warehouse2/warehouse3) as selected options without refreshing the page.
So how do I do it?? Is it fnReloadAjax or something else ?
This discussion has been closed.
Replies
Allan
I have used it but don't know how to assign a javascript fuction to fnAddData.Suppose i have a function "get_records()" which gets JSON data, then how do I assign it to API.
[code]$('#example').dataTable().fnAddData(get_records() );[/code]
Allan
It working fine but the problem is that am using select boxes on every column as filter.But the options in those select boxes are from previous data .[quote] oTable.fnClearTable();[/quote] doesn't clears the options and doesn't fills it with new data which is fetched using [quote]fnAddData[/quote].So what do I have to do to referesh those??
Thanks
Allan
Thanks a lot for the help.I recalled the method.I thought there would be an efficient method then this so I asked you.
Allan