First time here? Check out the FAQ!
I have a bandbox control in a MVVM form. The bandpopup displays a tree component, like...
groupbox form="@id('r') @load(vm.selectedResource) @save(vm.selectedResource, before='updateEntry') " visible="@load(not empty vm.selectedResource)" > <caption label="Resource detail"/> <grid> <columns> <column width="100px" label="" /> <column label="" /> <column width="100px" label="" /> <column label="" /> <column width="100px" label="" /> <column label="" /> </columns> <rows> <row> <cell> <label value="Resource category" /> </cell> <cell> <hlayout> <bandbox id="categoryBB" value="@bind(r.title)" readonly="true"> <bandpopup width="300px"> <tree id="categoryTree" model="@load(vm.categories)" checkmark="true" rows="8" vflex="true" onSelect="categoryBB.value=self.selectedItem.label; categoryID.value= self.selectedItem.value.data.ID; categoryBB.close();"> <treecols> <treecol label="" /> </treecols> <template name="model"> <treeitem open="true"> <treerow> <treecell label="${each.data.title}" /> </treerow> </treeitem> </template> </tree> </bandpopup> </bandbox>
With this bandbox the tree onSelect event is pushing the label of the selected tree item into the bandbox value, like:
onSelect="categoryBB.value=self.selectedItem.label; categoryNN.close();"
However, I've noticed that the new bandbox value is not being returned via the binding.
Any ideas?
I eventually resolved this using some zscript, see:
<hlayout> <zscript> public void onCategorySelect() { categoryBB.setValue(categoryTree.getSelectedItem().getLabel()); categoryBB.close(); BindUtils.postNotifyChange("DataAreaQueue", EventQueues.DESKTOP, null, "title"); } </zscript> <bandbox id="categoryBB" value="@bind(r.title)" readonly="true" constraint="no empty"> <bandpopup width="300px"> <tree id="categoryTree" model="@load(vm.categories)" checkmark="true" rows="8" vflex="true" onSelect="onCategorySelect()" selectedItem="@bind(r.selectedCategory)"> <treecols> <treecol label="" /> </treecols> <template name="model"> <treeitem open="true"> <treerow> <treecell label="${each.data.title}" /> </treerow> </treeitem> </template> </tree> </bandpopup> </bandbox>
Asked: 2012-06-12 06:41:11 +0800
Seen: 209 times
Last updated: Jun 19 '12