<zk>
<grid width="auto" sizedByContent="true" span="1" sclass="tblWithoutHover">
<attribute name="onCreate">
authorPublisherEtcInclude.insertBefore(self, authorBox);
</attribute>
<columns>
<column/>
<column/>
</columns>
<rows>
<row valign="center">
<cell colspan="2"><label use="${authorPublisherComponents.originalFieldsLabel}"/></cell>
</row>
<row valign="center">
<label use="${authorPublisherComponents.titleAuthorOriginalLabel}"/>
<textbox use="${authorPublisherComponents.titleAuthorOriginalTextbox}"/>
</row>
<row valign="center">
<label use="${authorPublisherComponents.mainAuthorOriginalLabel}"/>
<textbox use="${authorPublisherComponents.mainAuthorOriginalTextbox}"/>
</row>
<row valign="center">
<label use="${authorPublisherComponents.mainAuthorResponsibilityLabel}"/>
<selectbox use="${authorPublisherComponents.mainAuthorResponsibilitySelectbox}"/>
</row>
<row valign="center">
<label use="${authorPublisherComponents.authorityDatesOriginalLabel}"/>
<textbox use="${authorPublisherComponents.authorityDatesOriginalTextbox}"/>
</row>
<row valign="center">
<cell>
<label use="${authorPublisherComponents.addMainAuthorsOriginalLabel}"/>
<toolbarbutton use="${authorPublisherComponents.addAuthorButton}"/>
</cell>
<cell id="addAuthorsCell">
<grid id="addAuthorsContainer" model="@bind(ivm.inventory.addAuthorsBeans)">
<columns>
<column/>
<column/>
<column/>
</columns>
<rows>
<row>
<textbox value="@load(xgbfxb.authorName)" onChange="@command('test', component = self, index=s.index)"/>
<button label="Del" onClick="@command('delAuthor', container=addAuthorsContainer, index=modelIndex )">
<custom-attributes modelIndex="${s.index}"/>
</button>
</row>
</rows>
</grid>
<textbox use="${authorPublisherComponents.addMainAuthorsOriginalTextbox}"/>
</cell>
</row>
Here is part of my zul page. addAuthorsBeans is list of classes with fields. When I change data in my combobox, application call set method for all classes in list, but I want it to call only for corresponding item. Is it possible? Or should I cast black magic with onChange events and ViewModel methods?
Edit (21/12/2013). It works like this: I have got three items 1, 2, 3. Then I activate setAuthor for 2 item. And then application call setAuthor method for 2 item, then for 3 item, then for 1 item and then looking for this method in container.
I have 'black magic' temporary solution to create static variable and change it on first call of setAuthor method and unblock it in container.
But it's not a final solution, because it's consume more resources and really not how should it really works.
Solution: if you've got grid with model in another grid it will behaive very strange. So just use listbox instead.