Revision history [back]

click to hide/show revision 1
initial version

answered 2013-05-21 08:27:49 +0800

Senthilchettyin gravatar image Senthilchettyin flag of India

http://emrpms.blogspot.in...

Hi Benbai. Thank you. But in my case it is one to many relationship. Here is the code, but form status not changing to dirty.

Zul File

form="@id('fx') @load(vm.selectedRecord) @save(vm.selectedRecord, before='saveThis')">

---

---

<vlayout> <label value="Insurance"/> <hbox width="80%"> <textbox id="insurance" readonly="true" value="@bind(fx.insurance)" hflex="1"/> <toolbarbutton id="searchInsurance" sclass="gridToolbarButton" image="/images/search.png" onclick="@command('showInsuranceLookUp')"/> </hbox> </vlayout>

VM

@Command
public void showInsuranceLookUp() {
    ShowWindow.showInsuranceLookup();
}

// note this will be called from InsuranceLookup.java
@GlobalCommand
@NotifyChange({ "insuranceAddress", "." })
public void onSelectInsuranceLookup(
        @BindingParam("selectedRecord") Insurance insurance,
        @BindingParam("insuranceAddress") String insuranceAddress) {
    this.currentInsurance = insurance;
    this.insuranceAddress = insuranceAddress;
    this.selectedRecord.setInsurance(currentInsurance);
}

Hi Benbai. Thank you. But in my case it is one to many relationship. Here is the code, but form status not changing to dirty.

Zul File

form="@id('fx') @load(vm.selectedRecord) @save(vm.selectedRecord, before='saveThis')">

---

---

<vlayout> <label value="Insurance"/> <hbox width="80%"> <textbox id="insurance" readonly="true" value="@bind(fx.insurance)" hflex="1"/> <toolbarbutton id="searchInsurance" sclass="gridToolbarButton" image="/images/search.png" onclick="@command('showInsuranceLookUp')"/> </hbox> </vlayout>

VM

@Command
public void showInsuranceLookUp() {
    ShowWindow.showInsuranceLookup();
}

// note this will be called from InsuranceLookup.java
@GlobalCommand
@NotifyChange({ "insuranceAddress", "." })
public void onSelectInsuranceLookup(
        @BindingParam("selectedRecord") Insurance insurance,
        @BindingParam("insuranceAddress") String insuranceAddress) {
    this.currentInsurance = insurance;
    this.insuranceAddress = insuranceAddress;
    this.selectedRecord.setInsurance(currentInsurance);
}

I saw your code. On clicking of the first button, it is clean status. But on on clicking of second button, because of postevent, it becomes dirty state.

In my current project, scripting in the zul is disabled. So i have to trigger to the onchange event in the VM ? (But we are violating MVVM Concept?).

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