Is it right to set a Listgroup as open from within ListitemRenderer?

asked 2013-02-01 11:28:49 +0800

cvarona gravatar image cvarona
554 1 6


I'm using a custom listitem renderer in order to render a SimpleGroupsModel. I've realized that if I invoke ( ( Listgroup ) item ).setOpen( true ) upon rendering, this listbox loop

for (Listitem item = getItems().size() <= realOfs ? null: getItems().get(realOfs), nxt; j < pgsz && item != null; item = nxt) {
    nxt = nextListitem(item); //retrieve first since it might be changed

    if (item.isVisible()
    && (open || item instanceof Listgroupfoot || item instanceof Listgroup)) {
        renderer.render(item, j + ofs);
    if (item instanceof Listgroup)
        open = ((Listgroup) item).isOpen();

will start messing things up and invoking my renderer's render method with incoherent sets of arguments (a listgroup with the data corresponding the next listitem, for instance). This will visually translate in an equally chaotic listbox.

I don't know if this behaviour is due to some limitation on what can be done within a ListitemRenderer or can be considered rather a bug.

With kind regards

César Varona

delete flag offensive retag edit


Hi, can u given a sscce (http://sscce.org/) example, then we can help you quickly, thanks

noahhuang ( 2013-02-04 03:42:00 +0800 )edit

1 Answer

Sort by » oldest newest most voted

answered 2013-03-05 08:15:59 +0800

benbai gravatar image benbai
2228 6

It works fine for me, see sample at zkfiddle


        String[][] datas = new String[][] {
            new String[] { //group 1
                // Today
                "RE: Bandbox Autocomplete Problem",
                "RE: It's not possible to navigate a listbox' ite",
                "RE: FileUpload"
            new String[] { //group 2
                // Yesterday
                "RE: Opening more than one new browser window",
                "RE: SelectedItemConverter Question"
            new String[] { //group 3
                "RE: Times_Series Chart help",
                "RE: SelectedItemConverter Question"
        GroupsModel model = new SimpleGroupsModel(datas,
            new String[]{"Date: Today", "Date: Yesterday", "Date: Last Week"});
            //the 2nd argument is a list of group head

        ListitemRenderer renderer = new ListitemRenderer () {
            public void render(Listitem listitem, Object obj, int index) throws Exception {
                if (listitem instanceof Listgroup) {
                    if ("Date: Today".equals(obj.toString())) {
                    } else {
    <listbox model="${model}" itemRenderer="${renderer}">
        <listhead sizable="true">
            <listheader label="Subject"/>
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

1 follower



Asked: 2013-02-01 11:28:49 +0800

Seen: 29 times

Last updated: Mar 05 '13

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