DataTable: Not displayed when utilizing Reflow
See original GitHub issueDescription: 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:
- Build / Run the attached project.
- Click on ‘Show Section’
- 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>
Issue Analytics
- State:
- Created a year ago
- Comments:7 (7 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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 anupdate="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.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 startsdisplay: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 inrenderDeferred
thejq.is(":visible")
is of course false.