Skip to content

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

Closed
@ElizJogar

Description

@ElizJogar

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, [] );

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions