Skip to main content

Switch Between List/Item GETs

Switching between List and Item modes in Dynamic GETs ensures your data logic is suited for the view's purpose

What It Means

In Joomla Component Builder (JCB), every Dynamic GET can be marked as either a:

  • ๐Ÿงพ List GET โ€” designed to return multiple records (array or object list)
  • ๐Ÿ” Item GET โ€” intended to return a single row (single item detail view)

This setting directly affects:

  • The model methodโ€™s return behavior
  • Whether pagination and filters are auto-applied
  • The context of use (list views, detail pages, modals, etc.)

You control this setting via the Dynamic GET configuration screen using a toggle or dropdown labeled something like โ€œResult Typeโ€ or โ€œReturn Modeโ€.

Why It Matters

  • โœ… Contextual Output
    In a Site Viewโ€™s list screen, youโ€™ll want a GET to return many records. But on a detail page (or modal), you want only one โ€” typically by ID or slug.
  • ๐Ÿ” Shared Logic, Separate Usage
    The same base query (joins, filters) could be used in both forms โ€” one as a list (table), one as an item (card or profile).
  • ๐Ÿ“ฆ Model Code Optimization
    JCB compiles efficient code for the intended use. In list mode, youโ€™ll see loadObjectList() and pagination logic; in item mode, loadObject() or loadAssoc() is used instead.
  • ๐Ÿ’ก Combined GETs
    Some views in JCB support multiple Dynamic GETs. You can assign one as the list source and another as the item fetcher โ€” letting you fetch related data or secondary lookups in parallel.

Use Cases

  • Frontend blog view (list of articles) + article detail (item)
  • Admin import list + modal for editing one row
  • Dashboard summary (list) + modal drill-down (item)

Tips for Usage

  • Always filter Item GETs by primary key or slug
  • List GETs benefit from pagination and ordering
  • Choose the right return type early in development to avoid unexpected behavior

Conclusion

Switching between List and Item modes in Dynamic GETs ensures your data logic is suited for the view's purpose. Whether you're building complex interfaces or simple listings, this toggle saves time while keeping data fetching clean and purpose-driven.