0

Bandbox selection not updating form xxStatus.dirty property?

asked 2012-06-12 06:41:11 +0800

davout gravatar image davout
1429 3 18

updated 2012-06-12 06:47:24 +0800

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>


I've noticed that when the bandpopup tree selection is made the form 'xxStatus.dirty' flag is not set. Is this a bug? Is there a way around this? Can I somehow set the dirty flag in my tree onSelect javascript?

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2012-06-12 11:21:53 +0800

davout gravatar image davout
1429 3 18

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?

link publish delete flag offensive edit

answered 2012-06-15 04:28:20 +0800

paowang gravatar image paowang
140 6

Did you mean 'xxStatus.dirty' flag is not set?
But the form binding ID. in your example is 'r', the flag should be 'rStatus.dirty'.

What ZK version you use?
Can you provide some reproducible code?

link publish delete flag offensive edit

answered 2012-06-19 09:24:42 +0800

ten2net gravatar image ten2net
21

I meet this question too! but i using listbox not tree in bandbox

link publish delete flag offensive edit

answered 2012-06-19 09:55:32 +0800

ten2net gravatar image ten2net
21

try this:

<attribute name="onSelect">
bd.setValue(self.getSelectedItem().getLabel());
r.setField("title", self.getSelectedItem().getValue().toString());
bd.close();
</attribute>

link publish delete flag offensive edit

answered 2012-06-19 11:11:52 +0800

davout gravatar image davout
1429 3 18

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>

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-12 06:41:11 +0800

Seen: 209 times

Last updated: Jun 19 '12

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