Skip to content

JavaScript events ​

embedded-list.js starts every placeholder of the page when the document loads, and the ones a list or a new collection entry brings later.

EventTargetWhen
ea.embedded-list.refresheddocumentAfter every load of a list, with the list in event.detail.list.
ea.embedded-list.reloada listDispatch it to load the list's current URL again: its page, sort and search are kept.
js
document.addEventListener('ea.embedded-list.refreshed', ({ detail }) => {
  detail.list.querySelectorAll('[data-tooltip]').forEach(initTooltip);
});

// After a save elsewhere changed what a list shows:
list.dispatchEvent(new Event('ea.embedded-list.reload'));

A new load of a list aborts the one still pending for it: the latest wins.

Only the application's own pages are loaded in place. Links in the row actions (.actions), links with a target, and links and forms to another origin are left to the browser, and loadFragment() refuses a URL of another origin.

Markup ​

SelectorMeaning
.field-embedded-list[data-src]A placeholder; data-src is the URL it shows.
[data-loaded="true"]Set after each successful load.
[data-ea-fragment-initialised]The script started the list.
[data-ea-fragment-bound]A link or form the list loads in place.
[data-ea-fragment-header]The header the list sends.
[data-ea-inline-actions]Confirmed actions run in place.

Exports ​

The module exports init(), loadFragment(list, url), sameOrigin(url), the event names REFRESHED and RELOAD, and DEFAULT_HEADER.

Released under the MIT License.