Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot get output-widget to work on website #681

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

Cannot get output-widget to work on website #681

PlasticKnife opened this issue Jul 11, 2014 · 2 comments

Comments

@PlasticKnife
Copy link

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.

@Mottie
Copy link
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
@PlasticKnife
Copy link
Author

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
Projects
None yet
Development

No branches or pull requests

2 participants