Menu

#35 some content fail to post

open
nobody
None
5
2009-02-24
2009-02-24
Anonymous
No

this content fail to post, but if I separate it to 3 part then the result is ok.

bug there,

http://zkoss.org/forum/index.zul#path%3DlistComment%3BdiscussionId%3D6774%3BcommetId%3D27259%3BcategoryId%3D4%3B

content -======

Ok, I try to simulate your code and have some result.

you should not set a component's label if it bind with a value( in your case label="@{proc.sendTime, save-when='self.onCheck', load-when='buttonUpdate.onClick'}").
in you case, you call checkUpdate to update the label, and then databinding load the value of proc.sendTime and set the label back.
you should change the value of proc, not component's value.

I rewrite some code to accomplish your case. (since you didn't provide what is CommonData , so I created fake one)
[code]
<zscript>
void checkUpdate(Checkbox chbx,test.CommonData.Data data){
java.util.Date now = new Date();
String timestamp = java.text.DateFormat.getDateTimeInstance().format(now);
data.setSendTime(timestamp);
}
></zscript>
...
...
<rows>
<row self="@{each='proc'}" value="@{proc,save-when=none,load-when=none}">
<label style="padding-left:15px;color:green"
value="@{proc.name}" />
<label value="@{proc.owner}" />
<checkbox
checked="@{proc.sent, save-when='self.onCheck', load-when='buttonUpdate.onClick'}"
label="@{proc.sendTime, save-when='self.onCheck', load-when='buttonUpdate.onClick'}"
onCheck="checkUpdate(self,self.parent.value)" />
<checkbox
checked="@{proc.loaded, save-when='self.onCheck', load-when='buttonUpdate.onClick'}" />
</row>
</rows>
[/code]

check the line , it binds the proc to row whitout any save/load
[code]
<row self="@{each='proc'}" value="@{proc,save-when=none,load-when=none}">
[/code]
and , get the 'proc' back with self.parent.value
[code]
onCheck="checkUpdate(self,self.parent.value)" />
[/code]

Discussion