Skip to main content

Model Linking Between Views

Connect data intelligently across views using subforms, selectors, and dynamic relationships. What Is Model Linking?

Model Linking in Joomla Component Builder (JCB)

Model linking in JCB allows you to create structured relationships between views, enabling one view to reference data from another. This is particularly useful for building parent-child relationships (e.g., projects and tasks, categories and items), many-to-many selectors, and nested content managers โ€” all handled natively through JCBโ€™s GUI.

By using subforms, dynamic selectors, and foreign key references, you can establish interconnected models that mirror real-world data relationships.

Key Features

  • ๐Ÿ”— View-to-View Data Relationships: Link one view to another using foreign keys, dropdowns, multiselects, or repeatable subforms.
  • ๐Ÿงฉ Subform Integration: Embed entire child records into the parent form using Joomla's native subform fields โ€” with full create/edit/delete support.
  • ๐Ÿง  Smart Selectors: Use AJAX-powered dynamic selectors to reference data across views, with optional filters or cascading logic.
  • ๐Ÿ›  Auto Model Loading: JCB ensures models are correctly injected and accessible in views where linked data is needed โ€” without manual includes.
  • ๐ŸŽ›๏ธ Customizable Display: Linked data can be displayed as fields, tables, or modals in both the admin and site views โ€” using layouts or templates.
  • ๐Ÿ“š Reusability: Define reusable field types (with linking logic baked in) to easily reference the same view across multiple components.
  • ๐Ÿ”„ Round-Trip Compatible: Use insert/replace tags to persist custom code around linked logic between compiles.

Common Use Cases

  • Assign tasks to a project from the task view using a project dropdown.
  • Add multiple images to a gallery using a repeatable subform.
  • Link authors to articles via a multiselect field.
  • Create product attributes or variations using a related table.
  • Allow frontend users to select related records when submitting forms.

How to Configure in JCB

  1. In the Field Manager, create a new field and choose:
    • Field Type: subform, related dropdown, modal selector, etc.
  2. Under โ€œLinked View,โ€ select the view you want to reference.
  3. Define the target field or record identifier.
  4. Choose rendering behavior: dropdown, modal, subform, etc.
  5. Save the field and assign it to your View layout.
  6. (Optional) Customize layouts or templates to present linked data cleanly.

๐Ÿง  Pro Tip: Use conditional visibility to show/hide linked fields based on other selections (e.g., show sub-tasks only when a checkbox is selected).

Conclusion

Model Linking gives your components real structure. Whether you're building nested data hierarchies, many-to-many relationships, or intuitive selection workflows โ€” JCBโ€™s linking tools let you architect smarter, more connected interfaces in both admin and site environments.