[TYPO3-mvc] dataUrl instead of a store

Dennis Ahrens dennis.ahrens at googlemail.com
Mon May 31 15:18:48 CEST 2010


Hi Joachim,

Joachim Karl wrote:
> hello,
> 
> i try to find out, how i could initialize a dataUrl via  a viewhelper instead of a store. I like to realize a treepanel and therefore i need a dataUrl. Does anyone may have a hint for me?
> 
> thanks
> 
> joachim 

If you use mvc_extjs you can do this like this:

Write a Controller Action which assigns the used objects to your View-Layer

Write a ViewHelper that converts the objects into the correct json 
representation that is understandable by the extjs tree.

To fetch the right URL inside your JavaScript-Code you can use the 
SettingsViewHelper contained in mvc_extjs (at the moment only in the 
view-branch, i think).

Inside the action that draws your module/plugin do something like this:

$treeDataUrl = 
$this->uriBuilder->uriFor('treemapactionname','treemapactionsnamecontrollername');
$settings = array(
   'treeDataUrl' => $treeDataUrl,
);
$this->view->assign('settings',$settings);

Access the url in JavaScript like this:

url: YourExtname.module/pluginname.Settings.treeDataUrl,

regards
Dennis


More information about the TYPO3-project-typo3v4mvc mailing list