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

Incorrect behavior after setting the default column widths when using "overflow" #1514

Closed
ElizJogar opened this issue Feb 14, 2018 · 2 comments

Comments

@ElizJogar
Copy link

ElizJogar commented Feb 14, 2018

When I reset widths, the following code block is executed in the ResizableReset function:

 // restore the initial table width
 if ( vars.overflow && vars.tableWidth ) {
   ts.resizable.setWidth( c.$table, vars.tableWidth, true );
    if ( vars.useStorage ) {
      ts.storage( table, 'tablesorter-table-resized-width', 'auto' );
    }
 }

If I reload my app, the table width will be 'auto' instead of vars.tableWidth in the following code block:

if ( vars.useStorage && vars.overflow ) {
  // save table width
  ts.storage( c.table, 'tablesorter-table-original-css-width', vars.tableWidth );
  tmp = ts.storage( c.table, 'tablesorter-table-resized-width' ) || 'auto';
  ts.resizable.setWidth( $table, tmp, true );
}

And if I reset again, the table width will be vars.tableWidth.

I can offer the following fix:

 // restore the initial table width
 if ( vars.overflow && vars.tableWidth ) {
   ts.resizable.setWidth( c.$table, vars.tableWidth, true );
    if ( vars.useStorage ) {
      ts.storage( table, 'tablesorter-table-resized-width',  vars.tableWidth );
    }
 }

// Also I found a small typo in line 408:
ts.storage( this, ts.css.resizableStorage, {} );
I think, the following code is should be here:
ts.storage( this, ts.css.resizableStorage, [] );

@Mottie
Copy link
Owner

Mottie commented Feb 14, 2018

Hi @ElizJogar!

Thanks for reporting this issue and providing a fix! I really appreciate it.

I've added the changes you mentioned in the master branch, but I don't know when I'll make the next release available. I've got a few other issues to address before that happens.

@Mottie Mottie closed this as completed in 9d4cf18 Feb 14, 2018
@ElizJogar
Copy link
Author

Got it.
Thanks a lot, @Mottie!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants