Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ROU-4904: Fix ContextMenu to allow item changes when clicking on a co…
…lumn (#419) This PR is for fixing the misbehavior of the ContextMenu, when options are added/removed/made disabled, on the on the event of the `OnMenuToggle` of the `ContextMenu` block. ### What was happening * The changes made by the developer on a given column for the context menu: * Adding a new Item * Removing an item * Making an item enabled * Making an item disabled * Evidence of the problem: ### What was done * Made the event onToggle synchronous when the menu **is opening** * This will allow the changes made by the developer on the callback to be reflected on the items * This will cause the ChangeParameters to run before the method `_canRaiseClickEvent` is invoked * Made sure that when a context menu is opening, and an item is added or removed, that the itemSource is refreshed; ### Test Steps 1. Open the test page 2. Right click on the column: <table> <tr><th> </th><th> Description </th><th> Price </th><th>Name </th></tr> <tr><td rowspan="9">Menu options </td><td>Copy </td><td>Copy </td><td>Copy </td></tr> <tr><td>Copy with headers </td><td>This is the Price column </td><td>Copy with headers </td></tr> <tr><td>(separator) </td><td>Copy with headers </td><td>(separator) </td></tr> <tr><td>Export > </td><td>(separator) </td><td>Export > (disabled)</td></tr> <tr><td>(separator) </td><td>(separator) </td><td>(separator) </td></tr> <tr><td>Freeze column(s) </td><td>Export > </td><td>Freeze column(s) </td></tr> <tr><td>Unfreeze column(s) </td><td>(separator) </td><td>Unfreeze column(s) </td></tr> <tr><td> </td><td>Freeze column(s) </td><td> </td></tr> <tr><td> </td><td>Unfreeze column(s) </td><td> </td></tr> </table> ### Screenshots | Before| After | |:-------------:|:-------------:| | ![IssueContextMenuOnMenuToggle](https://github.com/OutSystems/outsystems-datagrid/assets/10534623/22ddd57a-42b4-4627-b177-676388560980) | ![context-menu-toggle](https://github.com/OutSystems/outsystems-datagrid/assets/10534623/80a55c60-e41b-474f-bfea-b4d70ea666d7) | ### Checklist * [x] tested locally * [x] documented the code * [x] clean all warnings and errors of eslint * [x] requires changes in OutSystems - description of the OnToggle event * [ ] requires new sample page in OutSystems (if so, provide a module with changes)
- Loading branch information