Revision history [back]

click to hide/show revision 1
initial version

answered 2009-05-14 14:45:14 +0800

james gravatar image james

Jumper thank you for your reply. The problem is this though, I'm creating a <toolbarbutton/> with an onClick event from a java file, not in a zul file. within the zul file everything works well. But I can't figure out how to programatically (within the java file) create an onClick event that will call a function that is writen in zscript in the zul file. Example:

public class EntryRowRenderer implements RowRenderer{ 
    public void render(Row row, java.lang.Object data) throws Exception {
    final ViewOrders order = (ViewOrders) data;
    final Toolbarbutton TBB = new Toolbarbutton();
    TBB.addEventListener("onClick", new EventListener() {
        public void onEvent(Event event) throws Exception {
            TBB.getPage().getZScriptFunction("EditAndPrepare("+order.get_orderID()+")", null); // this is the line in question.


void EditAndPrepare(String newWebOrderID){

<grid id="viewGrid" mold="paging" pageSize="20" pagingPosition="both">
    <columns menupopup="auto" sizable="true">
    <column label="Product" width="120" />
    <column label="Procedure" width="130" />
    <column label="DT" width="50px" />
    <column label="Cal Date" width="80px" />
    <column label="CT" width="50px" />
    <column label="Amount" width="58px" />
    <column label="Unit" width="40px" />
    <column label="Qty" width="30px" />
    <column label="Patient" width="110" />
    <column label="Note" width="90" />
    ArrayList orderEntryList = main.viewOrdersCombine(main.getDelDate());
    ListModel orderEntryListModel = new SimpleListModel(orderEntryList.toArray());
    viewGrid.setRowRenderer(new view.EntryRowRenderer());

So I want the button created in to execute the function EditAndPrepare() in entry.zul. Note: the toolbarbutton will be placed in the grid (viewGrid) when the setRowRenderer() is called I have also tried this function (which also fails to get the right function when you click on the toolbarbutton).

event.getTarget().getPage().getZScriptFunction("EditAndPrepare("+order.get_orderID()+")", null);

I hope this all makes sense as to what I'm asking for... (in a separate java file, create a component and add an onClick event that will call/execute a function written in zscript in a zul file)

Thanks to everyone who has taken time to help me. -James

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