I am trying to download the filtered content from the sorted table as a csv file. I am picking up the example from here.
However when I try the following code nothing happens. Am I doing something wrong here.
$("#download").click(function(){
wo = $("#table1")[0].config.widgetOptions;
wo.output_separator = ',';
wo.output_delivery = 'd';
wo.output_saveRows = 'f';
wo.output_saveFileName = 'myTable.csv';
$("#table1").trigger('outputTable');
return false;
});
table1 is id passed to the table sorter.
EDIT: There are no javascript errors in firebug. The function seems to complete fine but no download happening.
you are assigning
$wo = $("#table1").config.widgetOptions;
and then using wo
for further methods. You should use either wo
or $wo
.
I added these js files in my code and its working now:
<script src="http://mottie.github.io/tablesorter/js/jquery.tablesorter.js"></script>
<script src="http://mottie.github.io/tablesorter/js/widgets/widget-output.js"></script>
<script src="http://mottie.github.io/tablesorter/js/jquery.tablesorter.widgets.js"></script>
Remove any other tablesorter js and add the above ones.