Manipulate Form Middle Object

asked 2013-01-20 08:51:07 +0800

batman256 gravatar image batman256

updated 2013-01-20 08:52:54 +0800


I was wondering if there is a way to directly operate on the middle object of a form. In my use case, I want to dynamically add data rows to my entity. If the user cancels th operation, however, the added rows should be discarded. Currently the middle object seems not event to contain the current list of data rows that are stored in the entity. If a use the following code, no rows are shown although the entity contains two rows:

  <groupbox  form="@id('prn') @load(vm.workItemPRNummer) 
                  @save(vm.workItemPRNummer, before='addTranslation')
                  @save(vm.workItemPRNummer, before='deleteTranslation') >

        <column label="Sprache"/>
      <rows children="@load(prn.uebersetzungen)">
        <template name="children" var="item">
            <textbox value="@bind(item.sprache)" cols="2"></textbox>

If I replace the code to load the list property ('uebersetzungen') from the view model directly

<rows children="@load(vm.workItemPRNummer.uebersetzungen)">

the list is shown correctly. Also, when I add/delete items from the backing object, the list is updated accordingly.

What I really want however, is that the list of data rows is provided by the middle object and that I can add/delete rows from the middle object and have the changes written to the backing object once the user saves the form.

An I overlooking something here?


delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-02-07 02:10:59 +0800

jimmyshiau gravatar image jimmyshiau
4921 5
http://www.zkoss.org/ ZK Team

Hi batman256,

It seems a bug of zkbind, when you use children bind in a form, for now you can use model binding to instead of children bind.

<groupbox form="@id('prn') @load(vm.workItemPRNummer)" >
        <grid model="@load(prn.uebersetzungen)">
                <column label="Sprache" />
            <template name="model" var="item">
                    <textbox value="@bind(item.sprache)"
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




Asked: 2013-01-20 08:51:07 +0800

Seen: 28 times

Last updated: Feb 07 '13

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