0

Databinding on HTMLMacroComponent @Bind not working

asked 2014-11-02 14:43:49 +0800

snaef999 gravatar image snaef999
6 1

I have a HtmlMacroComponent that is embeded in a form defined as:

<vlayout form="@id('fx') @init(vm.fxForm) @load(vm.selectedProduction) @save(vm.selectedProduction, before='onUpdateProduction') @validator(vm.productionValidator)">
                <hbox align="center" hflex="1" />
                <grid hflex="1">
                    <columns>
                        <column valign="top" align="right" hflex="min" />
                        <column />
                    </columns>
                        <row>
                            <cell sclass="row-title">
                                Producer(s) :
                            </cell>

                            <cell>
                                     <clientSelector descriptor="Producers" userList="@load(fx.producers) @save(fx.producers, before='onUpdateProduction')" hflex="1" />
                                                           </cell>

                        </row>
                    </rows>
                </grid>
                <hlayout>
                    <button onClick="@command('onUpdateProduction')" label="Update" />
                    <button onClick="@command('reloadProduction')" label="Reload" />
                </hlayout>
            </vlayout>

My custom macro component <clientSelector> works correctly when databinding is defineded like the above. However, if I define databinding like:

<clientSelector descriptor="Producers" userList="@bind(fx.producers)" hflex="1" />

using the short hand @bind instead of @save and @load the value is not updated on the intermediate form object before the command operation. I thought the before='onUpdateProduction' would take care of this on its own? Why does the long form work but the short form not?

delete flag offensive retag edit

Comments

i have similar problem, so i wait ther for answer

czoki ( 2014-11-03 08:36:21 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-11-11 01:57:28 +0800

hawk gravatar image hawk
3250 1 5
http://hawkphoenix.blogsp... ZK Team

Because @bind doesn't accept conditional binding keyword before and after. The binder saves value to ViewModel according to certain event specified in lang-addon.xml please refer to http://books.zkoss.org/wiki/ZKDeveloper%27sReference/MVVM/Advanced/BindingAnnotationforaCustom_Component

link publish delete flag offensive edit
Your answer
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
2 followers

RSS

Stats

Asked: 2014-11-02 14:43:49 +0800

Seen: 24 times

Last updated: Nov 11 '14

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