Open an existing action from a controller

I have an existing action « my-action » defining a grid view and a form view

<action-view name="my-action" title="My action" model="com.my.model">
	<view type="grid" name="my-grid"/>
	<view type="form" name="my-form"/>
</action-view>

From a controller, I can use

actionResponse.setPending("my-action")
actionResponse.setReload(true)

and the correct action is loaded, opening the grid view.

Given an object id, how could I proceed to open the form view for that object instead of the grid view ?

Hello

Specify the form view first in the listing of view in action-view.

<action-view name="my-action" title="My action" model="com.my.model">
	<view type="form" name="my-form"/>
	<view type="grid" name="my-grid"/>
</action-view>

Thank you

Hello rch-axelor, thanks for your answer, it’s much appreciated !

In the controller, how would you specify the object id to be opened in that form, if even possible ?

Hello

Specify that id in action-view context with key _showRecord

<context name="_showRecord" expr="eval: recordId"/>

Thank you

Great, thank you

Ce sujet a été automatiquement fermé après 30 jours. Aucune réponse n’est permise dorénavant.