0

listheader binding (dynamic)

asked 2013-10-08 21:03:18 +0800

daovallec gravatar image daovallec
11 2

updated 2013-10-09 05:46:55 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

I have a code in ZK, and i am loading dates in a listheader, and i need load the same data in each day of the week, in my case the variable loadData is a List of Strings with two camps: {"atr1", "atr2"}, my Zk code is:

  <zk>
    <div apply="org.zkoss.bind.BindComposer"
         viewModel="@id('vm') @init('campaign.Campaign')" >
        <window id="usersEdit"> 

     <listbox>

          <auxhead>
                <auxheader colspan="2" class="topic">Lunes</auxheader>
                <auxheader colspan="2" class="topic">Martes</auxheader>
                <auxheader colspan="2" class="topic">Miercoles</auxheader>
                <auxheader colspan="2" class="topic">Jueves</auxheader>
                <auxheader colspan="2" class="topic">Viernes</auxheader>
                <auxheader colspan="2" class="topic">Sabado</auxheader>
                <auxheader colspan="2" class="topic">Domingo</auxheader>
            </auxhead>

    <listhead children="@load(vm.loadData)">
             <template name="children" var="headerName">
                 <listheader label="@load(headerName)" sort="auto" ></listheader>
                 <listheader label="@load(headerName)" sort="auto" ></listheader>
                 <listheader label="@load(headerName)" sort="auto" ></listheader>
                 <listheader label="@load(headerName)" sort="auto" ></listheader>
                 <listheader label="@load(headerName)" sort="auto" ></listheader>
                 <listheader label="@load(headerName)" sort="auto" ></listheader>
                 <listheader label="@load(headerName)" sort="auto" ></listheader>
             </template>
         </listhead>
  </listbox>

        </window> 
    </div>

    </zk>

The problem is that i not have the same data in columns for each day of the week.

I need somithing like that:

  lunes       martes       Miercoles      Jueves       Viernes       Sabado
atr1  atr2   atr1  atr2   atr1  atr2    atr1  atr2    atr1  atr2   atr1  atr2 ...

The problem is the listheader sort by name my columns, and i have something like:

  lunes       martes       Miercoles      Jueves       Viernes       Sabado
atr1  atr1   atr1  atr1   atr1  atr1    atr2  atr2    atr2  atr2   atr2  atr2 ...

How can i do to solve my problem, because i need load of a list, because the list is a query in my database.

Thanks

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-10-15 20:06:30 +0800

ajaidka gravatar image ajaidka
196 4

updated 2013-10-16 08:27:57 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

What I understand from your example is you have 7 auxheader, and under each you have to headers. And some how they are sorted. Please have a look at the example it worked very well for me

<?page title="new page title" contentType="text/html;charset=UTF-8"?>
<zk>
    <div>
    <zscript>
        ArrayList data = new ArrayList();
        data.add(new String[]{"atr1","atr2"});
        data.add(new String[]{"atr3","atr4"});
        data.add(new String[]{"atr1","atr2"});
        data.add(new String[]{"atr3","atr4"});
        data.add(new String[]{"atr1","atr2"});
        data.add(new String[]{"atr1","atr2"});
        data.add(new String[]{"atr1","atr2"});

    </zscript>
     <listbox>

          <auxhead>
                <auxheader colspan="2" class="topic">Lunes</auxheader>
                <auxheader colspan="2" class="topic">Martes</auxheader>
                <auxheader colspan="2" class="topic">Miercoles</auxheader>
                <auxheader colspan="2" class="topic">Jueves</auxheader>
                <auxheader colspan="2" class="topic">Viernes</auxheader>
                <auxheader colspan="2" class="topic">Sabado</auxheader>
                <auxheader colspan="2" class="topic">Domingo</auxheader>
            </auxhead>

        <listhead>
                <zk forEach="${data}">   
                    <listheader forEach="${each}" label="${each}" sort="auto" ></listheader>
                </zk>
         </listhead>
    </listbox>

    </div>

</zk>

Output is this http://screencast.com/t/RTLrBwHhTwo

Thanks AJaidka

link publish delete flag offensive edit
Your answer
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
1 follower

RSS

Stats

Asked: 2013-10-08 21:03:18 +0800

Seen: 28 times

Last updated: Oct 16 '13

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