-
FEATURED COMPONENTS
First time here? Check out the FAQ!
1 | initial version | |
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
<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);
}
2 | No.2 Revision |
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
<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?).