jmix-framework / jmix

Jmix framework
https://www.jmix.io
Apache License 2.0
693 stars 124 forks source link

Action EnabledRule is unaccounted in Table without loading data (port to 1.x) #3907

Open Flamesson opened 1 day ago

Flamesson commented 1 day ago

Environment

Jmix version: 1.6.0 (reproduces for 1.6.1 too)

Bug Description

Some actions of io.jmix.ui.component.Table are in incorrect state at io.jmix.ui.screen.Screen#AfterShowEvent if there was no data loading. User can click buttons which must be disabled according to related action's EnabledRule-s.

May be the same problem exists for DataGrid.

Steps To Reproduce

Run sample project: https://github.com/izumi-jmix/actions-loading. Follow steps from README.md file of the sample project.

Current Behavior

My opinion: 1) Screen XML is loading 2) Table XML is loading 3) Actions are loaded. Their state is refreshed. 4) Table data is bound. Actions state is refreshed. 5) Screen XML is loaded. 6) Screen injection happens. Annotated methods from controller are handled. Handled actions state is not refreshed. 7) Screen is shown.

Expected Behavior

1) Screen XML is loading 2) Table XML is loading 3) Actions are loaded. Their state is refreshed. 4) Table data is bound. Actions state is refreshed. 5) Screen XML is loaded. 6) Screen injection happens. Annotated methods from controller are handled. Handled actions state is refreshed. 7) Screen is shown.

Sample Project

https://github.com/izumi-jmix/actions-loading

glebfox commented 6 hours ago

Proposed solution: call refreshAction when enabledRule is added.