[TYPO3-mvc] Best practise for extdirect and extbase

Kevin Ulrich Moschallski km at 3digit.de
Thu Apr 28 14:52:15 CEST 2011


On 2011-04-28 13:08:47 +0200, Dennis Ahrens said:

> Hi Kevin,
> 
> On 20.04.2011 18:58, Kevin Ulrich Moschallski wrote:
>> i'm currently working on a extension where i want to use extjs datagrids
>> and therefore extdirect. I read the article in the TYPO3 wiki about
>> extdirect (http://wiki.typo3.org/ExtDirect) and took a look on mvc_extjs
>> (which is not working for me because the view calls the method setResult
>> of Tx_Extbase_MVC_Response which doesn't exist).
> 
> I rethought your problem and guess that you don't extend the controller 
> shipped in mvc_extjs. Just extend 
> Tx_MvcExtjs_MVC_Controller_ExtDirectActionController instead of 
> Tx_Extbase_MVC_Controller_ActionController.
> 
> If you have another inheritance structure and need to use another 
> controller implement initializeView like this to get rid of the error:
> 
> /**
>   * Initializes the View to be a Tx_MvcExtjs_ExtDirect_View that 
> renders json without Template Files.
>   *
>   * @return void
>   */
> public function initializeView() {
> 	if ($this->request->getFormat() === 'extdirect') {
> 		$this->view = 
> this->objectManager->create('Tx_MvcExtjs_MVC_View_ExtDirectView');
> 	$this->view->setControllerContext($this->controllerContext);
> 		}
> 	}
> 
> The reason is, that the FLOW3 package ships an own PHP based view to 
> render json directly. You have to assign it in your controller as it is 
> expected in the RequestHandler.
> 
> regards
> Dennis

Hi Dennis and Tim,

thanks for your replies and excuse me for the late reply, i was very 
busy with this project. I managed to get mvc_extjs working. I think the 
error was from a wrong implementation in my extension. Addiotionaly i 
had to create a new page type in my TS to disable the standard 
rendering of my page for the mvc_extjs calls. Therefore i added the 
type GET-paremter to 
Tx_MvcExtjs_ViewHelpers_ExtDirectProviderViewHelper which works fine 
for me, but it should be configurable.

The mvc_extjs extension is realy a great extension to work with 
ext.direct. Also i have to things i would change, maybe when i'm ready 
with the project and have some time.

1. The controller actions aren't usable for normal views, i.e. fluid 
because the method $this->view->setConfiguration() doesn't exist in 
fluid.

2. The possibility to use viewhelpers in combination with a basic 
template for the actions would be nice, this also would fix problem 1. 
A viewhelper would be nice i.e. for image manipulation. Currently i 
have a very ugly workaround in my controller where i resize the image 
manualy by copying the viewhelper logic.

Regards,
Kevin



More information about the TYPO3-project-typo3v4mvc mailing list