Initializing tabs after a shared modal partial is rendered


Topic: Initializing tabs after a shared modal partial is rendered

Ella Rossi asked 4 weeks ago

A shared layout inserts modal markup after the navigation. The first tab is visible, while other tabs remain inactive.

Should component initialization wait until all partials are present?


Igor Przybysz staff pro premium priority answered 4 weeks ago

Wait until the relevant elements are attached before initializing components that depend on them. DOMContentLoaded does not wait for a partial fetched afterward, so run the required setup from the partial's completed insertion callback. Do not reload the entire MDB bundle for every partial or repeatedly initialize unchanged navigation elements.

If your tabs are already present, check whether the shared partial replaces their container, duplicates their IDs, or throws an initialization error. Please include the partial-loading function and the Tab/Modal setup. We can then identify which new elements need initialization and which existing instances should be retained.

https://mdbootstrap.com/docs/standard/navigation/pills/


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB Standard
  • MDB Version: MDB5 9.3.0
  • Device: Laptop
  • Browser: Firefox
  • OS: macOS
  • Provided sample code: No
  • Provided link: No