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

Default widgetOptions are overwritten #1356

Closed
TheMrH opened this issue Feb 13, 2017 · 5 comments
Closed

Default widgetOptions are overwritten #1356

TheMrH opened this issue Feb 13, 2017 · 5 comments

Comments

@TheMrH
Copy link

TheMrH commented Feb 13, 2017

When i set some defaults with
$.extend(true, $.tablesorter.defaults, { widgetOptions: { stickyHeaders_includeCaption: true, filter_columnFilters: false }, ...
and I have multiple tables on a page the defaults get overwritten in jquery.tablesorter.js @ line 1932 applyWidgetOptions:
$.extend( true, ts.defaults.widgetOptions, widget.options );

@Mottie
Copy link
Owner

Mottie commented Feb 13, 2017

Hi @TheMrH!

I see what you're saying, but I can't duplicate the problem you're having... if I add a widgetOptions to the defaults, they it will be applied to all tables (demo)

$.extend(true, $.tablesorter.defaults, {
  widgetOptions: {
    filter_placeholder: {
      search: 'Search...'
    }
  }
});

$(function() {
  $('table').tablesorter({
    theme: 'blue',
    widgets: ['zebra', 'filter'],
    widgetOptions: {
      // filter_placeholder: { search: 'x' }
    }
  });
});

If I comment out the filter_placeholder option inside the initialization code in the demo, it overrides the default setting, as it should.

Would you please modify that demo to show the issue you're describing?

@TheMrH
Copy link
Author

TheMrH commented Feb 15, 2017

Hello @Mottie ,

Thank you for the swift reply and demo code. I've added another table which shows the problem at hand: the second table does not have the defaults applied, in this case no search text in the filter fields.

@Mottie
Copy link
Owner

Mottie commented Feb 15, 2017

Please modify the demo I shared, then use the "Update" button at the top. Then please, copy the new URL and share it with me.

@TheMrH
Copy link
Author

TheMrH commented Feb 16, 2017

Oops, I didn't know the url would be updated. Here is the new url: updated demo.

All I did was add a second table.

@Mottie
Copy link
Owner

Mottie commented Mar 7, 2017

Hi @TheMrH!

Sorry for the delay! I've been out of the country for the past 3 weeks. I do see the issue now and believe I have a fix. It will be available in the master branch for now. Expect a new release soon.

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