-
FEATURED COMPONENTS
First time here? Check out the FAQ!
HI,
I have a question on listbox. I have declared listbox like that:
<listbox id="left" mold="paging" pageSize="4"
width="100%" oddRowSclass="non-odd"
model="@load(vm.elements)"
selectedItem="@save(vm.element)"
onSelect="@command('modifyElement')">
when user select a list's element, this is save in "element" object and it's load in a form to modify element. When element is modify in form, I see that change the property on listbox.
I want to know there's a way to modify an element select from listbox without modify the property show in the listbox.
Thank's.
Hi Darksu,
I think it's not a problem of notify change.
When I modify element in form, at the same time change properties in listbox. I think that element is pass-by-reference. Is there a way to pass element by-value? Or Must I define a new element with item's properties selected?
Hello vsansone,
For more information on collection and selection for mvvm please read the following:
http://books.zkoss.org/zk-mvvm-book/8.0/databinding/collectionand_selection.html
To answer your question, you do not have to create a new element, but just use the updated model.
Also it is not clear what you want to achieve with the following code:
onSelect="@command('modifyElement')"
Since the following selectedItem="@save(vm.element)"
selects the object, and you can perform any operations there.
Let me know your thoughts.
Best Regards,
Darksu
Hello Darksu,
At first I want to thank you for your answers.
'onSelect' invoke a method to enable form and 'selectedItem' select element that's uploaded in the form. The problem is after, when I modify element in form, because listbox elements properties changes at the same time. I would like to maintain unchanged the elements of the list (@load(vm.elements)).
vsansone
Asked: 2016-09-01 08:16:41 +0800
Seen: 68 times
Last updated: Sep 07 '16
ZK drang and drop and databinding [closed]
Create Crud of a User that has a collection of books
Create a Zk session variable with a menu
Getting selected ListBox values on button Click | ZK
Problem binding values to a composite component
How to access static member field of a class in zul without zscript
How can i load a constant in .zul