0

How to post value into bandbox custom property with MVVM?

asked 2012-06-10 09:05:41 +0800

davout gravatar image davout
1435 3 18

I have a bandbox component that has a tree inside its bandpopup, like...

<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; categoryBB.close();">
			<treecols>
				<treecol	label="" />
			</treecols>
			<template	name="model">
				<treeitem>
					<treerow>
						<treecell label="${each.data.title}" />				                            	</treerow>
				</treeitem>
			</template>
		</tree>
	</bandpopup>
</bandbox>


The tree model node has a data object that has two properties: 'ID' and 'title'. Using the tree 'onSelect' method I want to push both the 'title' and 'ID' properties into the bandbox component. With the old MVC approach I used a 'onSelect' handler method in the composer class to set the ID into the bandbox via 'bandbox.setAttribute' method.

Any suggestions for how I can achieve this using MVVM?

delete flag offensive retag edit

2 Replies

Sort by ยป oldest newest

answered 2012-06-12 09:53:22 +0800

davout gravatar image davout
1435 3 18

I've tried working around this problem by using a hidden 'longbox' to store the ID code of the selected tree item, see:

<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>
	<longbox id="categoryID" visible="false" value="@bind(r.resourceCategoryID)" />
</hlayout>



When I run this the javascript is meant to push the ID value into the longbox value. However, when I retrieve the data for a save operation the longbox has the original values, not the ID value that should have been set into it.

Any suggestions for why this isn't working?

link publish delete flag offensive edit

answered 2012-06-14 11:10:39 +0800

vincentjian gravatar image vincentjian
2245 6

Hi,

I am not sure what your problem is. From the first post, you should be able to set value into bandbox.
Can you describe more details on you question?

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2012-06-10 09:05:41 +0800

Seen: 226 times

Last updated: Jun 14 '12

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More