question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Table switches to classic view if the containing UI has no size on load

See original GitHub issue

Describe the bug Fiddle: https://jsfiddle.net/seedante/ukL47r1x/37/

When creating a tabulator table the row manager forces “classic” rendering on init if the table has no size. This causes elements that get their size later (from code, perhaps) to no longer take advantage of virtual rendering, which can crash pages with larger tables.

Modern presentation frameworks often create/destroy/show/hide elements based on some code execution (React, Angular, etc.). They also apply styles based on runtime states, which may developers use as sizing/positioning.

Offending line: https://github.com/olifolkerd/tabulator/blob/3b2ca3c83e80a381d3e187052bd6dd3e570e3223/src/js/row_manager.js#L1139

Tabulator Info Version: 4.1.5

To Reproduce

  1. Load, it chooses “virtual” correctly.
  2. Click “Hide Table” and “Show Table”.
  3. The render type switches to “classic”, despite the element having size.
  4. Clicking “redraw” does not fix this issue.

Note that calling table.rowManager.setRenderMode(); inside the “refreshTable” example will correctly re-draw as virtual, since the table as size. This is not a valid solution since Tabulator does an initial draw as classic mode, which actualizes each row.

Expected behavior When the table is set to virtual, it always renders as virtual. Even if that produces no rows.

Desktop (please complete the following information): Chrome Version 72.0.3626.96 (Official Build) (64-bit)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
c-dantecommented, Feb 11, 2019

After updating the fiddle, I think the problem is fixed when I ask the row manager to set its render style on when I set the data – if the table is instantiated hidden, the row manager never updates the render style (even if it gets its size later).

I do still hold that where the RowManager determines its render style (and it being detached from the actual render code) can be thought of as a bug. Since the lifecycle of the table and the decision on render style don’t really align. 100% the resize observer makes this a non-issue, if you consider:

renderStyle = observe(table.elt.size) => (height && virtual) ? virtual : classic

I’m A-OK with that being the design decision, so no need to really change that. I think the unexpected thing for me is when element pop in and out of existence, that state can change without being told to update. Closing the issue.

0reactions
c-dantecommented, Feb 11, 2019

This fiddle shows the issue I’m hitting, and I’m 100% okay with that use case not being supported by tabulator. https://jsfiddle.net/seedante/ukL47r1x/69/

The flow is: On load, table has a height, everything virtualizes nice. If you show/hide the element (even with redraw when hidden), everything is still nice.

If you create the table while hidden, the table get set to classic – showing the element after, even having it redraw after it is shown and has height, will never get out of classic mode.

So, in that fiddle, you would do: Remote table, hide element, create table

My question (since this is definitely not an issue/bug, as the docs are very clear about it) is: why?

If I’m able to create the virtualized table with a height, hide it (so, no longer has a height), and set data or redraw, there’s no problem. But if I happen to make the table instance with no element height, it gets forced into classic mode.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Control when the system displays a view
Navigate to All > System UI > View Rules. Click New. Complete the form. Table 1. View rule form ...
Read more >
Table going out of div - Stack Overflow
@caro - I've updated my answer. Seems like your table is expanding beyond the bounds of #tablediv. You need to set it to...
Read more >
Responsive Table | SAP Fiori Design Guidelines
The responsive table is optimized for viewing one line item at a time with no scrolling or only vertical scrolling, irrespective of the...
Read more >
Control table UI component appearance and behavior
Table UI components display rows and columns of data in an app. The uitable function creates a table UI component and sets any...
Read more >
Common issues and resolutions for Power Apps
A list of common issues and resolutions within Power Apps.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found