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 9152749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:07:52+00:00 2026-06-17T12:07:52+00:00

As i am trying This example well define by Nabil Abdel-Hafeez It is working

  • 0

As i am trying This example well define by Nabil Abdel-Hafeez

It is working fine with some small issue which i already mentioned in tracker as issue. But i will want to Open a DualBox modal window in which one listbox contain all header name and other listbox will contain which header we will want to show for a listbox(I did this with getitemrendered ).I will want to use same ZUL Code without getitemrendered method.But user can hide the header which he/she do not want to see for a listbox. Anyone did this type of things?
Here

The green image with + Sign showing same thing which i will want to implement.

As I was trying the Nabil Abdel-Hafeez but my issue is that i will provide duallistbox where user can select which header he/she will want to see in listbox, user can select header by clicking on button ,user can add one header or all header from duallistbox and when user click on the Reorder button of duallistbox then it will reorder .In Nabil demo he is doing something like this..

for (Listitem item : lHead.getListbox().getItems()) {
  item.insertBefore(item.getChildren().get(from), item.getChildren().get(to));
}

But if user selecting multiple how we will track which will come first which second and so on..

  • 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-06-17T12:07:53+00:00Added an answer on June 17, 2026 at 12:07 pm

    You can try combine MVVM with forEach so you can construct String array to display, this works since 6.0.2

    e.g.,

    zul

    <zk>
        <div apply="org.zkoss.bind.BindComposer"
            viewModel="@id('vm') @init('test.TestVM')">
            <listbox model="@load(vm.model)">
                <listhead>
                    <listheader forEach="${vm.headers}" label="${each}" />
                </listhead>
                <template name="model" var="cells">
                    <listitem>
                        <listcell forEach="${cells}" label="${each}" />
                    </listitem>
                </template>
            </listbox>
            <button label="original seq" onClick="@command('originalSeq')" />
            <button label="reverse" onClick="@command('reverse')" />
        </div>
    </zk>
    

    VM

    package test;
    
    import org.zkoss.bind.annotation.Command;
    import org.zkoss.bind.annotation.NotifyChange;
    
    import org.zkoss.zul.ListModel;
    import org.zkoss.zul.ListModelList;
    
    import java.util.*;
    
    public class TestVM {
        private int[] _original = {1, 2, 3};
        private int[] _reverse = {3, 2, 1};
        private int[] _seq = _original;
        private List _rawData;
    
        public String[] getHeaders () {
            String[] headers = new String[_seq.length];
            for (int i = 0; i < _seq.length; i++) {
                int idx = _seq[i];
                headers[i] = (idx == 1? "First Name" :
                                idx == 2? "Last Name" :
                                idx == 3? "Age" : "");
            }
            return headers;
        }
        public ListModel getModel () {
            if (_rawData == null) {
                getRawData();
            }
            List modelData = new ArrayList();
            for (int i = 0; i < _rawData.size(); i++) {
                Person data = (Person)_rawData.get(i);
                String[] cells = new String[_seq.length];
                for (int j = 0; j < _seq.length; j++) {
                    cells[j] = data.getValue(_seq[j]);
                }
                modelData.add(cells);
            }
            return new ListModelList(modelData);
        }
        public void getRawData () {
            _rawData = new ArrayList();
            _rawData.add(new Person("First Name 01", "Last Name 01", 21));
            _rawData.add(new Person("First Name 02", "Last Name 02", 22));
            _rawData.add(new Person("First Name 03", "Last Name 03", 23));
        }
        @Command
        @NotifyChange("model")
        public void originalSeq () {
            _seq = _original;
        }
        @Command
        @NotifyChange("model")
        public void reverse () {
            _seq = _reverse;
        }
        class Person {
            private String _firstName;
            private String _lastName;
            private int _age;
    
            public Person (String firstName, String lastName, int age) {
                _firstName = firstName;
                _lastName = lastName;
                _age = age;
            }
    
            public String getFirstName () {
                return _firstName;
            }
            public String getLastName () {
                return _lastName;
            }
            public int getAge () {
                return _age;
            }
            public String getValue (int i) {
                return i == 1? getFirstName() :
                        i == 2? getLastName() :
                        i == 3? getAge() + "" : "";
            }
        }
    }
    

    Regarding forEach, please refer to ZK Iterative Evaluation

    Edit

    Fully binded sample at ZK fiddle

    Listbox Reorder Cells

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

Sidebar

Related Questions

I am learning LINQ and was trying out this example related to select clause.
Trying to follow this example. (Section String sorting...) Is there anything obvious that would
I'm trying to implement this example http://jsfiddle.net/gzF6w/1/ (from another question here on stak) on
I am trying to follow this example (from p137 of Rob Pickering's Foundations of
i'm trying to understand this in objective-c : in this example, indexPath is a
I'm trying something like this, but this example does not work. jsObj = {};
I'm a newbie to sql and am trying to follow this example here: http://net.tutsplus.com/tutorials/php/a-better-login-system/
I am new to maven and I am trying to follow this example but
Ok, I'm very simply trying to take this example... http://jsfiddle.net/shanabus/HGF59/ and put it on
In this example code, I'm trying to offset the Grid 's Canvas position by

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.