On this page
- Basic contract
- Language in the browser
- Feature scope and automatic initialization
- Ajax: HTML is the standard
- Normal request remains functional
- Confirm: Declarative standard
- Confirm and Ajax: Sequence
- Programmatic Confirm
- JSON-Ajax
- core.js and UI state
- report.js, form.js and grid.js
- Other system libraries
- Binding rules
- Minimum tests
- Further chapters
dbxapp-JavaScript is a declarative extension of server-side pipelines. core.js detects required features, loads them and re-initializes them even after a HTML Ajax replacement.
The full interaction with a module is under Mandatory module manual.
Basic contract
| Task | Systemlib |
|---|---|
| Feature recognition and UI state | core.js |
| HTML-/JSON transport | ajax.js |
| Confirmation | confirm.js |
| Windows | openWin.js |
| Form interaction | form.js |
| Report, Pagination and Selection | report.js |
| Grid/Tabulator | grid.js |
| Longer processes | process.js |
An existing system capability is not fetch(), window.confirm(), a second modal or direct browser storage.
Language in the browser
General framework texts such as “Ja/Nein/Abbrechen“, sorting states” or technical runtime errors are centralized with dbx.translate(key, fallback) Dissolved from active language. Technical texts, on the other hand, remain the property of the language-dependent FD and are used on the server side in HTML or data attributes:
So there are exactly two clear levels:
- central JavaScript translation for generic controls of the libs;
- active FD for form, report and technical reports of a module.
Module JavaScript does not have its own third translation table for the same form texts.
Feature scope and automatic initialization
Features are registered on a root:
The scope is the root element and its children. A nested feature does not accidentally process elements of a neighboring module. Initialized after Ajax core.js only the newly deployed area again.
Use form and report templates {i} in IDs:
Thus, several instances of the same route remain separate from each other.
Ajax: HTML is the standard
One form:
A link:
Canon attributes:
| Attribute | Meaning |
|---|---|
| data-ajax target | Target DOM ID |
| data-ajax-mode="html" | Server provides HTML |
| data-ajax-replace="target" | Replace destination nodes completely |
| data-ajax-replace="content" | Replace only the target content |
| data-ajax-url | URL deviation from the inherited form/link destination |
| data-ajax method | explicit HTTP method, if not derivable |
| data-ajax-params | Additional controlled parameters |
Existing alt attributes such as Data target or data-replace remain compatible in existing modules. The new templates should data-ajax*Use names because purpose and affiliation are unique.
dbx ajax=1 It is not written in normal links. Only ajax.js sets the Ajax context of the request it executes.
Normal request remains functional
Ajax is progressive improvement:
- The link has a real href.
- The form must contain: Action, method And a real submit button.
- The server can render the same route completely.
- Ajax replaces only the appropriate partial view.
A module action must not only work if a JavaScript event handler has been executed.
Confirm: Declarative standard
Important attributes:
| Attribute | Meaning |
|---|---|
| data-confirm | Short form of the question |
| Data Confirm Quest | explicit question |
| Data-confirm-title | Title of the dialogue |
| data-confirm-hint | Additional note |
| data-confirm buttons | yesno, yesnocancel or Cancel |
| data-confirm-labelyes | Label for Yes |
| data-confirm labelno | Labelling for No |
| data-confirm-labelcancel | Abort label |
| data-confirm-closable | Allow closing over X |
| data-confirm backdropclose | Allow closing over background |
| data-confirm escclose | Allow Close via Escape |
When “Yes” is set confirm.js the original link, button or form action continues automatically. is the same source as dbxAjax marked, the Ajax path is used first; Otherwise, the normal browser path will follow.
Confirm does not perform a mutation and is not a safety check. Rights, validation and, for mutating GETs, the action tokens are checked on the server side.
Confirm and Ajax: Sequence
The module should not replicate this order with its own click handlers. In particular, Confirm and openWin may not independently process the same click.
Programmatic Confirm
Only if the declarative continuation is not sufficient:
The Promise delivers yes, No, Cancel or close. Here, too, the domain mutations belongs on the server. Own dialogue DOM structures are not required.
JSON-Ajax
HTML is suitable for dbxForm and dbxReportBecause both return complete partial views. JSON is suitable for limited status or API actions:
JSON and HTML routes have different response contracts. A JSON route does not render a form template. A normal Form/Report Ajax does not provide an arbitrary mixed response.
core.js and UI state
Direct access to: localStorage or sessionStorage outside of core.js is prohibited. Only the central state can control namespaces, compatibility and cleanup system-wide.
report.js, form.js and grid.js
report.js assumes:
- Pagination ajax;
- single and multiple selection;
- reporting actions;
- Selection state and reload.
form.js assumes:
- Form state;
- Submit mechanics and field interaction;
- Reinitialization to Ajax.
grid.js assumes:
- Tab/grid output;
- column widths and visibility;
- Inline Edit and Grid Reload;
- UI state over core.js.
Domain modules complement configuration and subject endpoints, not the base pipeline.
Other system libraries
| Libraria | Task |
|---|---|
| adminDashboard.js | Dashboard areas and diagrams |
| menu.js | navigation and history |
| utilities.js | general UI utilities, Collapse, Theme/Skin |
| ace.js | Source and Template Editor |
| cms.js | Stable CMS/Jodit core, cursor and component processing |
| cms-page.js | Page form and page actions; Charged in advance in the CMS |
| cms-tree.js | content tree; Loaded only when opened |
| cms-media.js | Media browser, upload and media maintenance; Loaded only when used |
| cms-language.js | language matching and language dialogues; Loaded only when used |
| cms-jodit-image.js | extended iodite image dialog; Only loaded in the image dialog |
| kiBriefing.js | AI briefing surface |
| seoAdmin.js | SEO administration |
The CMS modules shall be: dbx.cmsRuntime registered. Only the core necessary for each processing and the page controller are initially loaded. A feature module shall not build a second Ajax, window, layer or editor infrastructure; Requests run over ajax.jswindow over openWin.js and joint helpers are obtained from the runtime context. The browser cache reduces repeated transmission, but lazy loading also saves parse, initialization and event costs for unused functions.
Binding rules
- Use existing lib, not a second implementation.
- Limit the feature to the smallest meaningful root.
- {i} and use unique targets for repeatable components.
- Genuine href-/ActionReceive fallbacks.
- Use HTML as the default response for form and report.
- Treat Confirm only as a user interaction.
- Eligibility, validation and mutation can only be decided on the server side.
- dbx ajax Do not manually build into normal URLs.
- JavaScript must be repeatable initializable after an Ajax replacement.
- Avoid direct browser storage.
Minimum tests
- Link/Formular without JavaScript;
- the same sequence with Ajax;
- correct and missing target;
- two instances of the same component;
- Confirm “Yes”, “No”, Escape and Close;
- no request for "no";
- Exactly one request at “Yes”;
- invalid rights or tokens are rejected on the server side;
- Renewed feature function after a target replacement.