0

Detail component error org.zkoss.zk.ui.UiException: Widget class required for <Detail lZ4Vf4> with default

asked 2016-01-05 14:52:44 +0800

gbacigalupo gravatar image gbacigalupo
1

Hi all,

I am facing an issue with ZK 7.0.2 version.

I have a grid defined on my zul file and then, on the Java Composer I add dynamically a Detail component for each row. It compiles but on runtime I get the following error when going to render the grid:

org.zkoss.zk.ui.UiException: Widget class required for <Detail lZ4Vf4> with default

Here is the .zul:

<window id="controlPointCheckerController"
        apply="${controlPointCheckerController}">
                          <grid id="gridControlPoints">
                                <columns sizable="true"
                                    style="text-align: center;" height="30px">
                                    <column width="28px" />
                                    <column
                                        label="${c:l('cpc.select')}" width="65px" />
                                    <column
                                        label="${c:l('cpc.editor')}" width="145px" />
                                    <column
                                        label="${c:l('cpc.dateEdition')}" width="155px" />
                                    <column
                                        label="${c:l('cpc.changeReason')}" />
                                    <column
                                        label="${c:l('cpc.type')}" width="115px" />
                                    <column
                                        label="${c:l('cpc.actions')}" width="150px" />
                                </columns>
                            </grid>
</window>

And on the .java file:

    public class ControlPointCheckerController extends GenericForwardComposer {

    public void render (Row row, Object data,int paramInt) throws Exception {

                row.setAlign("center");

                Detail det = new Detail();
                det.setOpen(false);
                Div detailContent = new Div();

                detailContent.setParent(det);
                row.appendChild(det);
               (...)
         }
}

Thanks for your help.

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2016-01-17 14:25:55 +0800

Darksu gravatar image Darksu
1991 1 4

Hello gbacigalupo,

Please use as a reference the following code:

Zul:

<zk>
    <window border="none" apply="pkg$.MasterDetailComposer">
        <grid id="grid">
            <columns>
                <column width="10%"/>
                <column label="test" />
            </columns>
        </grid>
    </window>
</zk>

Java:

package pkg$;

import java.util.ArrayList;
import java.util.List;

import org.zkoss.zk.ui.util.GenericForwardComposer;
import org.zkoss.zul.Detail;
import org.zkoss.zul.Grid;
import org.zkoss.zul.Label;
import org.zkoss.zul.ListModelList;
import org.zkoss.zul.Row;
import org.zkoss.zul.RowRenderer;
import org.zkoss.zul.Window;

public class MasterDetailComposer extends GenericForwardComposer<Window> {

    private static final long serialVersionUID = 748611244810222881L;

    private Grid grid;

    public void doAfterCompose(Window comp) throws Exception {
        super.doAfterCompose(comp);
        List<String> list = new ArrayList<String>();
        list.add("item 1");
        list.add("item 2");
        list.add("item 3");
        ListModelList<String> model = new ListModelList<String>(list);
        grid.setModel(model);
        grid.setRowRenderer(new RowRenderer<String>() {
            public void render(Row row, String data, int index) throws Exception {
                Detail detail = new Detail();
                new Label("detail data of item 1").setParent(detail);
                detail.setParent(row);
                new Label(data).setParent(row);
            }
        });
    }
}

Best Regards,

Darksu

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: 2016-01-05 14:52:44 +0800

Seen: 27 times

Last updated: Jan 17 '16

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