Hello everyone,
I’m struggling with closing a popup opened via an action-view that only contains a grid view.
I added a button in the toolbar that performs an action on the selected rows. I would like the popup to close automatically once the action is done… but neither the XML action close nor response.setCanClose(true) in the controller actually close the window.
Environment
- Axelor Open Platform: 7.x
- Context: popup opened by
action-viewwith<view type="grid">only (no form/wizard)
Minimal reproduction (XML + Java)
1) Opening the popup (action-view)
<action-view name="my.lines.select.popup" model="com.example.db.MyLine">
<view type="grid" name="my-line-grid"/>
<view-param name="popup" value="true"/>
<view-param name="title" value="Select lines"/>
</action-view>
2) Grid with toolbar button
<grid name="my-line-grid" model="com.example.db.MyLine">
<toolbar>
<!-- Run the action on the selected rows and (ideally) close the popup -->
<button name="btnApply" title="Apply"
onClick="my.applySelection,close"/>
</toolbar>
<!-- columns… -->
</grid>
<!-- Action wrapping the controller call -->
<action-method name="my.applySelection" model="com.example.db.MyLine">
<call class="com.example.web.MyLineController" method="apply">
<arg name="ids" expr="__ids__"/> <!-- selected rows -->
</call>
</action-method>
3) Java controller
public class MyLineController {
@SuppressWarnings("unchecked")
public void apply(ActionRequest request, ActionResponse response) {
List<Long> ids = (List<Long>) request.getContext().get("ids"); // passed from action-method
// ... business logic on the selected rows ...
// Attempts to close the popup:
// 1) XML action: onClick="my.applySelection,close" --> does not close
// 2) Java side:
response.setCanClose(true); // also doesn’t close in this "grid-only" context
// (I’m not doing any response.setView(...) afterwards)
}
}
Expected behavior
- After clicking “Apply”, the action runs correctly and the popup closes.
Actual behavior
- The action executes correctly but the popup remains open.
What I’ve already tried / checked
- Chaining
,closeafter anaction-method(not callingclass: methoddirectly). - Using
response.setCanClose(true)at the end of the controller method. - I also tried using a button with only
close(without my custom action), but that didn’t work either.
Questions to the community
- Is this an expected behavior/limitation of “grid-only” popups opened with
action-view? Arecloseand/orsetCanClose(true)ignored in this context? - Is there a recognized way to force closing a
gridpopup after a toolbar action (e.g., some intermediate action, additional view parameter, etc.)? - Does anyone have a working example (XML/Java) where a grid toolbar button in a popup executes an action on
__ids__and closes the popup afterwards?
Thanks in advance for any help or hints