Cannot get output-widget to work on website #681

Closed
PlasticKnife opened this Issue Jul 11, 2014 · 2 comments

Comments

Projects
None yet
2 participants

Hi,

I created this fiddle by combining your columnSelector-widget demo and your output-widget demo.

The fiddle works as expected, but whenever I try to run this in my website it does not work.

Even though I have modified the .htaccess file to include this as you explain in the widget-output demo:

<FilesMatch "\.(?i:csv|txt)$">`
    ForceType application/octet-stream`
    Header set Content-Disposition attachment`
</FilesMatch>

The Get CSV button just reloads the page but it does not open the popup or download the file.

When i click the Get CSV button I get this error:

Uncaught TypeError: cannot read property 'widgetOptions' of undefined

I think I am missing something on the php side but I am not sure what.

Owner

Mottie commented Jul 11, 2014

Hi @hungryforsuccess!

Can you share an example of your javascript? The demo seems to be working fine, aside from not applying a file name or extension.

Anyway, I think I might have found an alternate method that will allow downloading a file with file name & extension without requiring any server-side modification. I am having some trouble with how IE deals with the code, but once I get around that issue, I'll include the change in the next update.

@Mottie Mottie added Widget and removed How To... labels Jul 11, 2014

Hi,

I figured out the solution to my problem. The page I was trying to set this up contained other tables besides the table with the tablesorter class. So in the download function, I just had to specify the table with the tablesorter class as such:

var $table = $('table.tablesorter'); // instead of $table = $('table');
$('.download').click(function () 
{
   var delivery = $('option[name=delivery]:selected').attr('data-delivery');
   $table.data('tablesorter').widgetOptions.output_delivery = delivery;
   $table.trigger('outputTable');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment