[TYPO3-mvc] Best practise for extdirect and extbase
Dennis Ahrens
dennis.ahrens at googlemail.com
Thu Apr 28 13:08:47 CEST 2011
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
More information about the TYPO3-project-typo3v4mvc
mailing list