Commit 40e00453 authored by David Metzler's avatar David Metzler

Issue #2706359: Ajax Command Support - Working Ajax render element.

parent f32d6fd5
......@@ -21,15 +21,19 @@ class Invoke implements AjaxCommandInterface{
* {@inheritdoc}
*/
public function commandFromSettings(array $settings) {
dpm($settings);
$selector = $settings['selector'];
$method = $settings['method'];
$arguments = [];
if (isset($settings['arguments'])) {
$arguments = $settings['arguments'];
if (!is_array($arguments)) $arguments = json_decode($arguments);
}
elseif (isset($settings['text'])) {
$arguments = json_decode($settings['text']);
}
if (!$arguments) $arguments = array();
dpm($arguments, 'args');
$command = ajax_command_invoke($selector, $method, $arguments);
return $command;
}
......
......@@ -257,6 +257,8 @@ class FrxReport {
* @return unknown_type
*/
public function render($format, $render_form=TRUE, $cache_data=array()) {
$events = $this->commands;
$this->commands = array();
if (!$format) $format = 'web';
// Only push the parameter conte
Frx::Data()->push($this->parms, 'parm');
......@@ -294,9 +296,7 @@ class FrxReport {
}
// Process the commands after the replacement
if ($this->commands) {
$events = $this->commands;
$this->commands = array();
if ($events) {
foreach ($events as $event => $commands) {
foreach($commands as $command) {
$this->addAjaxCommand($command, $event);
......
......@@ -1341,6 +1341,11 @@ function forena_forena_controls() {
'class' => 'FrxDrupalControls',
);
$controls[] = array(
'file' => 'renderers/FrxAjax.inc',
'class' => 'FrxAjax',
);
$controls[] = array(
'file' => 'renderers/FrxSection.inc',
'class' => 'FrxSection',
......
<?php
/**
* Created by PhpStorm.
* User: metzlerd
* Date: 4/21/16
* Time: 8:32 PM
*/
/**
* Crosstab Renderer
*
* @FrxRenderer(id = "FrxAjax")
*
*/
class FrxAjax extends FrxRenderer {
public function render() {
$text = forena_inner_xml($this->reportDocNode, $this->reportDocNode->getName());
$command = $this->replacedAttributes();
$command['text'] = $text;
unset($command['renderer']);
$event = $this->extract('event', $command);
if (strpos($event, 'pre')===0) {
$event = 'pre';
}
else {
$event = 'post';
}
$this->frxReport->addAjaxCommand($command, $event);
return '';
}
}
\ No newline at end of file
......@@ -17,6 +17,7 @@ class FrxRenderer {
public $name;
public $id;
public $format;
/** @var FrxReport */
public $frxReport; // The report object being used.
public $columns;
public $numeric_columns;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment