Skip to content

Commit

Permalink
fixed: csv view not working
Browse files Browse the repository at this point in the history
  • Loading branch information
pollen8 committed Nov 12, 2013
1 parent bc814be commit e8e9294
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions components/com_fabrik/views/csv/view.html.php
Expand Up @@ -41,8 +41,9 @@ public function display($tpl = null)
$this->table = $listModel->getTable();
$data = array();
$this->getManagementJS($data);
$this->id = $this->get('id');
$this->form = $this->get('Form');
$this->id = $listModel->getId();
$this->form = $listModel->getForm();
$this->shim();

if (!$listModel->canCSVExport())
{
Expand All @@ -54,6 +55,20 @@ public function display($tpl = null)
return parent::display($tpl);
}

/**
* Ini the Fabrik requirejs framework files
*
* @return void
*/
protected function shim()
{
$shim = array();
$dep = new stdClass;
$dep->deps = array('fab/fabrik', 'fab/listfilter', 'fab/advanced-search', 'fab/encoder');
$shim['fab/list'] = $dep;
FabrikHelperHTML::iniRequireJS($shim);
}

/**
* Get the js needed for the view
*
Expand All @@ -72,7 +87,7 @@ protected function getManagementJS($data = array())
$opts->admin = $app->isAdmin();
$opts->form = 'listform_' . $listid;
$opts->headings = $model->jsonHeadings();
list($this->headings, $groupHeadings, $this->headingClass, $this->cellClass) = $this->get('Headings');
list($this->headings, $groupHeadings, $this->headingClass, $this->cellClass) = $model->getHeadings();
$labels = $this->headings;

foreach ($labels as &$l)
Expand Down Expand Up @@ -118,12 +133,9 @@ protected function getManagementJS($data = array())
$srcs = FabrikHelperHTML::framework();
$srcs[] = 'media/com_fabrik/js/list-plugin.js';
$srcs[] = 'media/com_fabrik/js/list.js';
FabrikHelperHTML::script($srcs);

$script[] = 'window.addEvent("fabrik.load", function() {';
$script[] = 'var list = new FbList(' . $listid . ',' . $opts . ');';
$script[] = 'Fabrik.addBlock(\'list_' . $listid . '\', list);';
$script[] = '})';
FabrikHelperHTML::addScriptDeclaration(implode("\n", $script));
FabrikHelperHTML::script($srcs, implode("\n", $script));
}
}

0 comments on commit e8e9294

Please sign in to comment.