[Flow] Links from ajax widgets to outside actions

Bastian Waidelich bastian at typo3.org
Wed Jul 2 14:54:13 CEST 2014


Teo C. wrote:

Hi Teo,

> I created an ajax widget for filtering a table. [...] the links [...] are all
> wrong (a "subpackage" parameter is added to the link).

The current ActionRequest of an widget (when called via AJAX) is 
"out-of-context", for the autocomplete widget it looks like this for 
example:
  controllerPackageKey => 'TYPO3.Fluid'
  controllerSubpackageKey => 'ViewHelpers\Widget'
  controllerName => 'Autocomplete'
  controllerActionName => 'autocomplete'
  arguments => {
    'term' => 'xyz'
  }
  internalArguments => {
    '__widgetId' => '123'
    '__widgetContext' => TYPO3\Fluid\Core\Widget\WidgetContext
  }

So there is no parent request and the current request reflects the AJAX 
endpoint.

Thus, to create a link to a different package or controller you must 
specify all relevant arguments:

<f:link.action action="foo" controller="Bar" package="Your.Package">some 
link</f:link.action>



> I tried using the "useParentRequest" parameter in the links but now I
> got the error "You can't use the parent Request, you are already in the
> MainRequest. [...]
> Was not the purpose of "useParentRequest" to avoid those problems ? Any
> suggestions ? Thank you !!

useParentRequest is useful for Neos plugins and non-AJAX widgets (e.g. 
the "paginate" VH) for example.


-- 
Bastian Waidelich


More information about the Flow mailing list