优化工具栏“全选”功能 by CiiLu · Pull Request #5867 · HMCL-dev/HMCL
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Attach select-all listener to current ListView items
listView.getItems().addListener(listener) is registered before setItems(filteredList) is called, so this listener stays attached to the initial default list instead of the actual filteredList backing the view. As a result, the new select-all disable state is not recomputed when the displayed datapack list changes without a selection change (for example when items are refreshed/updated), and the button can remain incorrectly disabled after the list size changes. Register the items listener after setItems(...) (or observe itemsProperty) so it tracks the active list.
Useful? React with 👍 / 👎.