Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4087286
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:50:09+00:00 2026-05-20T18:50:09+00:00

I am trying to make editable listbox that gives user ability to update listitem

  • 0

I am trying to make editable listbox that gives user ability to update listitem or cancel it.But I can’t get selected item for save it on another bean and then if user clicks cancel , show original record. This returns me null.

Listitem listitem =  self.getParent().getParent();
Listbox listbox = listitem.getListbox();
alert(listbox.getSelectedItem().getValue());

Also I am using zscript on .zul file for making this operation. here my listbox and update function

<listbox id="listModel" rows="10" mold="paging" pageSize="10"
    selectedItem="@{mainCtrl.selected}" fixedLayout="true"
    model="@{mainCtrl.model}">
    <listhead>
        <listheader
            label="${c:l('SYSADM.ManageImportedSubscribers.table.MSISDN')}"
            sort="auto" />
        <listheader
            label="${c:l('SYSADM.ManageImportedSubscribers.table.Date')}"
            sort="auto" />
        <listheader
            label="${c:l('SYSADM.ManageImportedSubscribers.table.CO_ID')}"
            sort="auto" />
        <listheader
            label="${c:l('SYSADM.ManageImportedSubscribers.table.Customer_ID')}"
            sort="auto" />
        <listheader label="Update ?" sort="auto" />
    </listhead>

    <listitem self="@{each=MANAGE_IMPORTED_SET_DATA}">
        <listcell>
            <label value="@{MANAGE_IMPORTED_SET_DATA.MSISDN}"></label>
            <textbox value="@{MANAGE_IMPORTED_SET_DATA.MSISDN}"
                visible="false" />
        </listcell>
        <listcell>
            <label value="@{MANAGE_IMPORTED_SET_DATA.IMPORT_ID}"></label>
            <textbox value="@{MANAGE_IMPORTED_SET_DATA.IMPORT_ID}"
                visible="false" />
        </listcell>
        <listcell>
            <label value="@{MANAGE_IMPORTED_SET_DATA.CO_ID}"></label>
            <textbox value="@{MANAGE_IMPORTED_SET_DATA.CO_ID}"
                visible="false" />
        </listcell>
        <listcell>
            <label value="@{MANAGE_IMPORTED_SET_DATA.CUSTOMER_ID}"></label>
            <textbox value="@{MANAGE_IMPORTED_SET_DATA.CUSTOMER_ID}"
                visible="false" />
        </listcell>
        <listcell>
            <button label="Update">
                <attribute name="onClick">
    Button update;
    Button delete;
    Button save;
    Button cancel;

    update = self;
    delete = self.getNextSibling();

    update.setVisible(false);
    delete.setVisible(false);

    Listitem listitem = self.getParent().getParent();
    int i = 0 ;                               
    while(i != 4){
        Listcell listcell = (Listcell)listitem.getChildren().get(i);
        ((Label)listcell.getChildren().get(0)).setVisible(false);
        ((Textbox)listcell.getChildren().get(1)).setVisible(true);
        i++;
    }

    self.getParent().appendChild(save=new Button("Save"));
    save.addEventListener("onClick",new EventListener() {
        public void onEvent(Event arg0) {
            alert("SAVE CLICKCED");
            }
    });                                                        

    self.getParent().appendChild(cancel = new Button("Cancel"));
    cancel.addEventListener("onClick",new EventListener() {
    public void onEvent(Event arg0) {
        Listitem listitem1 =  self.getParent().getParent();
        int i = 0 ;
        while(i != 4) {
            Listcell listcell = (Listcell)listitem1.getChildren().get(i);
            ((Label)listcell.getChildren().get(0)).setVisible(true);
            ((Textbox)listcell.getChildren().get(1)).setVisible(false);
            i++;
        }

        Listcell listcell = (Listcell)listitem1.getChildren().get(4);
        ((Button)listcell.getChildren().get(0)).setVisible(true);
        ((Button)listcell.getChildren().get(1)).setVisible(true);
        ((Button)listcell.getChildren().get(2)).detach();
        ((Button)listcell.getChildren().get(2)).detach();
        }
    });
                </attribute>
            </button>
            <button label="Delete" onClick="onDelete()"></button>
        </listcell>
        <listcell></listcell>
    </listitem>
</listbox>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T18:50:10+00:00Added an answer on May 20, 2026 at 6:50 pm

    The data binding support save-when and load-when concept in annotation. You can specify “save-when: none” in zul annotation so the databinder will not save data from UI into bean for you automatically. However, then you have to do the “save” by yourselves in your event listener.

    <listcell><label value="@{MANAGE_IMPORTED_SET_DATA.MSISDN}" ></label><textbox value="@{MANAGE_IMPORTED_SET_DATA.MSISDN, save-when='none'}" visible="false" /></listcell>
    <listcell><label value="@{MANAGE_IMPORTED_SET_DATA.IMPORT_ID}"></label><textbox value="@{MANAGE_IMPORTED_SET_DATA.IMPORT_ID, save-when='none'}" visible="false" /></listcell>
    <listcell><label value="@{MANAGE_IMPORTED_SET_DATA.CO_ID}" ></label><textbox value="@{MANAGE_IMPORTED_SET_DATA.CO_ID, save-when='none'}"  visible="false"/></listcell>
    <listcell><label value="@{MANAGE_IMPORTED_SET_DATA.CUSTOMER_ID}"></label><textbox value="@{MANAGE_IMPORTED_SET_DATA.CUSTOMER_ID, save-when='none'}"  visible="false"  /> </listcell>
    

    For details, you can check this JavaDoc (search “save-when”):

    http://www.zkoss.org/javadoc/5.0/zk/org/zkoss/zkplus/databind/AnnotateDataBinder.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to make a make generic select control that I can dynamically add elements
I am trying to make an editable text object in cocoa that contains no
I am trying to make my UITableView Editable but I'm having some trouble with
Trying to make a regex that can handle input like either: Beverly Hills, CA
I'm trying to make the case for click-once and smart client development but my
I'm trying to make a context menu for a control that is linked to
I am trying to make a div, that when you click it turns into
I am trying to make a JTable that has column spans available. Specifically, I
i am trying to make a text box no editable for the users. I
I'm trying to make PDF forms (aka AcroForms) editable in Java. So far i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.