fix: DataTables in iframe modals shows 0 rows on initial load - #1794
Open
marcusegger wants to merge 1 commit into
Open
fix: DataTables in iframe modals shows 0 rows on initial load#1794marcusegger wants to merge 1 commit into
marcusegger wants to merge 1 commit into
Conversation
DataTables grids inside PresideIframeModal render 0 rows on initial load because the iframe container is hidden (display:none) during DataTables initialisation. Column dimensions are zero at that point, causing the first AJAX response to be discarded without rendering. Binding fnDraw() to the shown.bs.modal event ensures the grid redraws once the modal is fully visible and dimensions are available. This fix is relevant to older Preside CMS versions as well and should be backported accordingly.
marcusegger
force-pushed
the
fix/iframe-modal-datatable-redraw
branch
from
June 11, 2026 12:59
761c99a to
8ccd45e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When a
PresideIframeModalis opened (e.g. when managing a one-to-manyrelationship via
manageOneToManyRecords), any DataTables grid inside theiframe renders 0 rows on initial load despite a successful AJAX response.
The root cause: Preside wraps the iframe in
<div style="display:none;">during setup. DataTables initialises and fires its first AJAX request while
the container is still hidden. Since column dimensions are zero at that
point, the returned rows are not rendered.
The issue manifests in modern Chromium-based browsers and is observable
whenever a one-to-many listing is opened as an iframe modal in the Preside
admin.
Workaround (before this fix): typing any character into the search field
and deleting it triggers a redraw and the rows appear.
Fix
Bind
fnDraw()to theshown.bs.modalBootstrap event so that allobject-listing-tableDataTables inside the iframe redraw once the modalanimation has completed and the container has proper dimensions.
The existing
onShowcallback behaviour is preserved.Affected versions
This issue affects older Preside CMS versions as well and the fix should
be backported accordingly.