Revision history [back]

click to hide/show revision 1
initial version

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

hawk gravatar image hawk

http://hawkphoenix.blogsp... ZK Team

how to make component load data after button click event

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.

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