1

MVC :Grid regrouping rows

asked 2014-06-11 10:23:36 +0800

elmetni gravatar image elmetni
145 7

hello everyone

i m working on a ZK project what i need to do is create a Grid with a regrouping model , but i want to create my groups manualy , and get rows for each group using a model ,

here what i tried to do so far but it not seems to work

here what i got :
www.mediafire.com/view/5inz91y4rvm2ng2/t1.png

and here what i want to get :
www.mediafire.com/view/dsustou6m1non93/t2.png

here is my view

<window apply="test.FruitProvider">
    <grid id="mygrid">
        <columns>
            <column label="this is a title"> </column>

        </columns>
        <rows>

         <group label="myGroup1"    />
          <template name="model">
            <row>

            <label  value="${each}"></label>
            </row>
        </template>
        <group label="myGroup2"    />
          <template name="model">
            <row>
            <label  value="${each}"></label>
            </row>
        </template>
        <group label="myGroup3"    />
          <template name="model">
            <row>
            <label  value="${each}"></label>
            </row>
        </template>
        </rows>
    </grid>
</window>

and here is my controler

public class FruitProvider extends  org.zkoss.zk.ui.select.SelectorComposer<Window>{

    @Wire
    Grid  mygrid;
    ListModelArray<String> fruit=new ListModelArray(
            new String[] {
                    "Apple",
                    "Orange",
                    "Mango"    });; 
    @Override
    public void doAfterCompose(Window comp) throws Exception {      
        super.doAfterCompose(comp);     
        mygrid.setModel(fruit); 
    }
}

can you help me pls?

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2014-06-11 23:06:08 +0800

mhj gravatar image mhj flag of Brazil
806 1 7

Hello elmetni, have you seen this link? grouping_model maybe that can help you...

link publish delete flag offensive edit

Comments

ya i did but in my case i have to create groups manualy

elmetni ( 2014-06-12 12:25:51 +0800 )edit

the grouping model is the way to go as mhj said. If you use <template name="model"> that will replace all manually added children including groups. And only one template will be used - you cannot have 3 with the same name (not sure if the last or the first one wins).

cor3000 ( 2014-06-13 05:13:51 +0800 )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
2 followers

RSS

Stats

Asked: 2014-06-11 10:23:36 +0800

Seen: 32 times

Last updated: Aug 30 '16

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