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.
| Event | Target | When |
|---|---|---|
ea.embedded-list.refreshed | document | After every load of a list, with the list in event.detail.list. |
ea.embedded-list.reload | a list | Dispatch 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
| Selector | Meaning |
|---|---|
.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.