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.

DataTable: Not displayed when utilizing Reflow

See original GitHub issue

Description: DataTables with “reflow=true” are not shown when nested within an element that contains “style=display: none;”. When attempting to show the hidden element, the style attribute on the DataTable is set to: null;visibility:hidden;

@melloware, I believe this bug was introduced while attempting to resolve Issue: #7050, #7038 with Commit: 52071270f5f710b0add34fdd4748ac1174b66a4d

Reproducer primefaces-test.zip

Environment:

  • PF Version: 11.0.0
  • PF Theme: Saga
  • JSF + version: Mojarra 2.2.20
  • Affected browsers: ALL

To Reproduce Steps to reproduce the behavior:

  1. Build / Run the attached project.
  2. Click on ‘Show Section’
  3. See bug

Expected behavior I’d expect both the DataTable with “reflow=true” and without “reflow” to be shown.

Actual behavior Only the table without “reflow=true” is shown.

Example XHTML

<p:commandButton onclick="$('#section').show();" type="button" value="Show Section"/>
<div id="section" style="display: none;">
    <h1>Reflow:</h1>
    <p:dataTable reflow="true" ...>
    ...
    </p:dataTable>

    <h1>No Reflow:</h1>
    <p:dataTable ...>
    ...              
    </p:dataTable>
</div>

primefaces-test.zip

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
mellowarecommented, Apr 1, 2022

I can’t believe this hasn’t come up before either but I think its because most people are not loading their components to the page with display:none…they are doing an update="section" on the DIV around the table and basically letting AJAX load it lazily when you click the Show button. You are preloading yours into the DOM only to then try and show it. so my guess its not a common use case because its not quite the “JSF way” of doing things.

1reaction
mellowarecommented, Mar 31, 2022

Workaround attached: pf-8614.zip

Just do this onclick="PF('tblReflow').jq.css('visibility', 'visible');$('#section').show();"

However @tandraschko I think there is a bigger issue here I don’t quite get. The Datatable _render method is NEVER called so there is actually a bigger bug here than just this. Basially nothing in the _render method gets called so this means in the scenario above where it starts display:none none of the setup code for sticky, scrolling etc would ever get set up.

I have a breakpoint in _render and it never gets called because in renderDeferred the jq.is(":visible") is of course false.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is there a reflow method for datatables?
I would need to call a reflow method after deleting some stuff from a table. function doDelete(id) { $.
Read more >
primefaces datatable reflow in desktop browser - Stack Overflow
i have a primefaces datatable, the table is very long which is why i want to show it in column stacked mode, i...
Read more >
not getting columns stack in dataTable using reflow
I have a primefaces datatable using reflow attribute having 9 columns, when zoom-in the table should show in column stacked mode but result ......
Read more >
primefaces - issue #1363 - Google Code
I try to format my columns in a p:dataTable. My Target is to align the columns with numbers to the right. Example 1:...
Read more >
Table: Reflow - jQuery Mobile Demos
The reflow responsive table only requires a table with a data-role="table" on the table element. There is no need to set the data-mode...
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