Problem/Motivation
Forena supports Ajax Page loads of forena reports, however, there are some conditions where we'd like to support having a report writer edit/use an arbitrary ajax command during the page load process. This would be used for performing common tasks, like highlighting the selected row in a page or for altering the url so that parameter states are persisted in case a user hits reload on the page.
Proposed resolution
Add support for a new custom tag <frx:commands>
specified in the head of the report that would allow specifying a list of commands that would be run after (or before) the content is delivered. The commands would get their options from attributes, or from an embedded JSON element. Each <frx:commands>
element would contain one or more <frx:ajax>
element with the following attributes supported as in the following example.
<head>
...
<frx:commands>
<frx:ajax command="invoke" method="attr" selector="input#id">[ "checked", "1" ]</frx:ajax>
<frx:ajax command="alert" text="Hello World"/>
<frx:ajax command="replace" selector="#total-hours">{summary.total}</frx:ajax>
</frx:commands>
</head>
In the d8 version, we would allow definition of new custom commands by implementing a new FrxPlugin of type AjaxCommand. Modules could implement new ajax commands using class annotations. On D7, we would stick with a hard coded list of ajax commands.
Remaining tasks
- Create a patch on d8
- Backport to D7
- Document new Elements
API changes
New FrxPlugin type supporting ajax command. No existing apis would be affected.
Comments
Comment #2
metzlerd CreditAttribution: metzlerd commentedComment #3
metzlerd CreditAttribution: metzlerd commentedComment #4
metzlerd CreditAttribution: metzlerd commentedComment #14
metzlerd CreditAttribution: metzlerd commented