-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello,
I have this strange problem with clearing Listbox selection, it just doesn't work for me.
View:
<listbox model="@load(vm.tableDataModel)" selectedItems="@bind(vm.selectedTableItems)"> ... <template name="model" var="tableItem"> ... </template> </listbox> <button label="Dismiss" onClick="@command('dismissChanges')"></button>
ViewModel:
private Set<ShiftBean> selectedTableItems = new HashSet<ShiftBean>(); private ListModelList<ShiftBean> tableDataModel = new ListModelList<ShiftBean>(); public Set<ShiftBean> getSelectedTableItems() { return selectedTableItems; } public void setSelectedTableItems(final Set<ShiftBean> items) { selectedTableItems = items; } public ListModelList<ShiftBean> getTableDataModel() { return tableDataModel; } @Command public void dismissChanges() { if (!selectedTableItems.isEmpty()) { tableDataModel.clearSelection(); } else { Clients.showNotification("empty"); } }
Now the important information:
if I leave my command like it is without any @NotifyChange then selection is visually cleared but the real data in selectedTableItems is not changed and the next tableDataModel update selection visually comes back.
But if I add this
@NotifyChange({"tableDataModel", "selectedTableItems"})
Any ideas, please?
Hi ,
Please update selectedTableItems = null and then add in the NotifyChange..and also you can change the position sometime position also effects.
@NotifyChange({"selectedTableItems", "tableDataModel"}).
Thanks
Thank you sjoshi but it doesn't work. I've tried with different @NotifyChange order and tried with "selectedTableItems = null" with/without/before/after clearSelection and it still doesn't work...
Can it possible for you to post ur code here so that i can test it in my environment.
thanks
Asked: 2012-09-16 22:41:12 +0800
Seen: 137 times
Last updated: Oct 14 '12