-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WSDropDown: Changing selected items and reloading data restores previously selected items #165
Comments
The changed value on line 28 does not propagate to the TreeView control if the Action Menu is currently the active picker control. Therefore the WSTreeView does not know that the value has changed, so when The reason why the selection is restored after reload can be found in the implementation for Fit.UI/Controls/DropDown/WSDropDown.js Line 514 in 28ae44d
Notice the |
The solution might be as simple as to ensure the WSTreeView has the most recent value (selection) using Fit.UI/Controls/DropDown/WSDropDown.js Line 514 in 28ae44d
However, with this approach we do not ensure that the built-in WSTreeView's selection state is kept up to date at all time - although that's not a new problem. But it does mean that external code can't rely on DropDown's selection state being in sync with the WSTreeView instance's selection state, which is accessible through But with this approach we would probably need to update the WSTreeView's selection state once Reload(..) has completed in For an always up-to-date selection state in the WSTreeView instance we could instead make sure to always update the WSTreeView's selection state when it is not the active picker control, like the example below demonstrates: Unfortunately this comes with a major performance penalty when working with huge amounts of data and a very large selection of these data, since SetSelections(..) eventually ends up resolving selected nodes using a recursive lookup through For an always-up-to-date TreeView we will most likely need to increase the performance for GetChild(..) first. Rather than updating the entire selection state on every change, it would make more sense to only update the node that was actually selected or de-selected. But that solution would be more complicated, involving overriding the DropDown's AddSelection(..), RemoveSelection(..), ClearSelections(), and Value(..) functions in WSDropDown, and we would need a mechanism that would prevent DropDown (from which WSDropDown inherits) from synchronizing these changes from the WSTreeView back to the WSDropDown from where the change originated. |
#165: Changes to WSDropDown's value was not synchronized to WSTreeView picker if one of the WSListView pickers (for search and action menu items) was the active picker. This resulted in the previous value being restored when calling wsDropDown.ClearData() and wsDropDown.AutoUpdateSelected() to resolve updated display values for the newly assigned dropdown value. This has now been fixed by ensuring that WSTreeView is always kept up to date with the current selection state in WSDropDown as they happen, rather than "catching up" when WSTreeView is set as the active picker control. #166: Changes made to selection state via a WSDropDown's picker control directly (e.g. dd.GetTreeView().EnsureData(function(sender) { sender.GetChild("ROOTNODE").Selected(true); });) would not propagate to host control (WSDropDown) unless pull down menu had been opened first, which would set up the necessary synchronization events. This has now been resolved. Also fixed a bug in WSTreeView where clearing the control with Value("") would add a preselection with an empty value.
Synchronization problem fixed. TreeView is now kept up to date at all times. The implementation was based on the last fix suggested - it did not require additional logic to prevent an infinite loop - it was already in place. |
See https://jsfiddle.net/604f8uak/3/
Click the button to change selected values. Notice how the previous selection remains, even though it shouldn't. The problem is related to the use of the Action Menu. Comment out UseActionMenu(true) and it works as expected.
Code from JSFiddle:
The text was updated successfully, but these errors were encountered: