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

  1. Create a patch on d8
  2. Backport to D7
  3. Document new Elements

API changes

New FrxPlugin type supporting ajax command. No existing apis would be affected.

Comments

metzlerd created an issue. See original summary.

metzlerd’s picture

Title: Arbitrary Ajax Command Support » Ajax Command Support
metzlerd’s picture

Issue summary: View changes
metzlerd’s picture

Issue summary: View changes

  • 7cba4b5 committed on 8.x-1.x
    Issue #2706359: Ajax Command Support
    

  • e4403bf committed on 7.x-4.x
    Issue #2706359: Ajax Command Support
    

  • 601a476 committed on 7.x-4.x
    Issue #2706359: Ajax Command Support - Pre and post events
    

  • 8710f09 committed on 8.x-1.x
    Issue #2706359: Ajax Command Support - FrxAjax Renderer
    

  • 40e0045 committed on 7.x-4.x
    Issue #2706359: Ajax Command Support - Working Ajax render element.
    

  • 805f3b4 committed on 7.x-4.x
    Issue #2706359: Ajax Command Support - Remove dpm debugs... oops.
    

  • c188e1a committed on 8.x-1.x
    Issue #2706359: Ajax Command Support - Ajax Command Documentation.
    

  • 113f488 committed on 8.x-1.x
    Issue #2706359: Ajax Command Support - Ajax Command Documentation.
    

  • 2cfa75f committed on 7.x-4.x
    Issue #2706359: Ajax Command Support - Documentation.
    
metzlerd’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.