0

how to make component load data after button click event

asked 2009-04-16 04:11:15 +0800

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

updated 2009-04-16 04:12:37 +0800

Hi guys,

Here is my ZUML and sample code:
<listbox id="eListbox" model="@{employeeComposer.employees, load-when='add.onClick'}"
selectedItem="@{employeeComposer.selectedEmployee}">
...
<hbox>
<button id="add" label="Add" forward="onAdd"/>
<button id="save" label="Update" forward="onSave"/>
<button id="enable" label="Enable" forward="onEnable"/>
<button id="disable" label="Disable" forward="onDisable"/>
<button id="delete" label="Delete" forward="onDelete"/>
<button id="reset" label="Reset" forward="onReset"/>
</hbox>

..
public class EmployeeComposer extends GenericAutowireComposer {
...
public void onAdd(){
employeeDAO.insert(selectedEmployee);
}
public void onSave(){
employeeDAO.update(selectedEmployee);
}
public void onEnable(){
employeeDAO.enable(selectedEmployee);
}
public void onDisable(){
employeeDAO.disable(selectedEmployee);
}
public void onDelete(){
employeeDAO.delete(selectedEmployee);
}
}

I want to refresh the page when user click add button.
I use load-when attribute but I found it load data before user click add button, so it won't load the latest data from database.
Currently, I know a solution is to add one line in each event handler method:
Executions.getCurrent().sendRedirect(null);

is there a solution without writing code? (just modify ZUML)
thanks.

delete flag offensive retag edit

1 Reply

Sort by ยป oldest newest

answered 2009-04-17 02:41:14 +0800

PeterKuo gravatar image PeterKuo
481 2

updated 2009-04-17 02:41:46 +0800

Time is the cure.
The lifecyle of load-when and forward event will be rearranged in near future.

link publish delete flag offensive edit
Your reply
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

RSS

Stats

Asked: 2009-04-16 04:11:15 +0800

Seen: 444 times

Last updated: Apr 17 '09

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