-
Bug
-
Resolution: Fixed
-
Critical
-
6.5.1
-
None
-
os x, java 1.7
-
None
When we have two viewmodels one inside the other (parent model view and child model view) commands are not binding correctly, if commands are in the child viewmodel, on a row generated by template.
If we have two modelviews one(child) inside other(parent), and commands are fire from the child modelview inside something generated by template. Example:
<window apply="org.zkoss.bind.BindComposer" viewModel="@id('vmparent') @init('net.ParentVm')"> ... <window apply="org.zkoss.bind.BindComposer" viewModel="@id('vmchild') @init('net.ChildVm')"> <button label="othercommand" onClick="@command('othercommand')"/> <grid model="@bind(vmchild.elements)" > <rows> <template name="model" var="element"> <row> <button label="Edit" onClick="@command('editSelectedItem',item=element)"></button> <!-- here is the problem --> </row> </template> </rows> </grid> </window> </window>
Zk thinks that the command "editSelectedItem" should be in net.ParentVm, and is trying to locate there, but it is not there, the command is located on net.ChildVm.
And I got an error : cannot find any method that is annotated for the command editSelectedItemwith @Command in net.ParentVm
This bug is very strange because if I click first on "othercommand" which was not on "template" is located correctly, and after that, the error stop rising.