FileExport not working for dynamic data
FileExport not working for dynamic data
Hi Team,
We have a table in which the data is binding dynamically. We use sharepoint online and in aspx page there is a textbox and button. On click of the button, we have to get list items from a sharepoint list using spservices and bind the datatable with the data.
Your code is working perfectly for the first time and we can export the data to csv file. But when user changes the text and clicks submit again then it is not working.
We have tried using destroy and clear. but nothing worked. Please help us how to rebind the data to datatable. It will be a great help if you provide solution for this.
Answers
If you aren't using the API to update the data in the table, then that is the issue. But without a test case (which is required in the forum rules) I can't say for sure.
Allan
Hi Allan,
We are using sharepoint online and in that there is an aspx page. In that there is a drop down field which contains all departments. If user selects the department and clicks on submit button then from 2 lists we have to fetch the data and merge it and display it in a single table. The columns are fixed.
I am doing that using SPServices and CAML query. On success method of the spservices i am calling your datatables method(which is in submit button click). If user again changes the department and clicks on submit again then i have to fetch the data from sharepoint list again merge it and add it to html table again.
Here i am facing issue. when the data is changed from first time then datatables export to csv is not working. Below is my code:
$().SPServices
({
operation: method,
async: false,
webURL: webURL,
listName: list,
CAMLViewFields: "<ViewFields Properties='True' />",
CAMLQuery: query,
completefunc: function (xData, Status)
{
$(xData.responseXML).SPFilterNode("z:row").each(function()
{
---- my Code ---
});
});
$('#myHTMLTable').DataTable( {
dom: 'Bfrtip',
buttons: [ {
extend: 'csv',
text: 'Export to CSV'
} ]
} );
above code i have written in button click event.
Thanks for the additional information - I hadn't realised that you had form elements in the table. Unfortunately that is a situation that is not currently supported by Buttons. I'm still trying to think of a way to implement it that would be reasonably performant.
Allan