Revision history [back]

click to hide/show revision 1
initial version

asked 2013-09-26 02:41:33 +0800

daovallec gravatar image daovallec

Combobox with zk error

I have this zk code:

<hbox pack="center" align="top" width="100%" height="400px">
<style src="/widgets/combobox/simple_combobox/css/simple_combo.css" />
<div apply="org.zkoss.bind.BindComposer" height="278px" width="443px"
 viewModel="@id('vm') @init('ShirtViewModel')">
    <separator spacing="40px" />
    <hbox>
        <vlayout>
            <separator/>
            <label value="Color" />
            <combobox id="cmbColor" width="150px"
                  model="@load(vm.names)" selectedItem="@bind(vm.iname)">
            </combobox>
        </vlayout>

    </hbox>
</div>
</hbox>

and i have this java class:

public class ShirtViewModel {
    private String iname, iSize;
    private  List<String> names = Arrays.asList("juan", "marcus", "pedro");
    private  List<String> sizes =  Arrays.asList("big", "little", "medium");

    public List<String> getNames() {
        return names;
    }

    public void setNames(List<String> names) {
        this.names = names;
    }

    public void setSizes(List<String> sizes) {
        this.sizes = sizes;
    }

    public List<String> getSizes() {
        return sizes;
    }

    @Init
    public void init() {
        setIname("juan");
        setiSize("big");
    }

    public String getIname() {
        return iname;
    }

    public void setIname(String iname) {
        this.iname = iname;
    }

    public String getiSize() {
        return iSize;
    }

    public void setiSize(String iSize) {
        this.iSize = iSize;
    }

And i have an error with this code and i do not know why?

The error that i have is, and i have like model my class, i do not know what happen:

org.zkoss.zk.ui.UiException: model of the databind combobox <combobox dyfq8#cmbcolor=""> must be an instanceof of org.zkoss.zkplus.databind.BindingListModel.[juan, marcus, pedro] org.zkoss.zkplus.databind.SelectedComboitemConverter.coerceToUi(SelectedComboitemConverter.java:129)

Somebody can help me, and say me how can i correct my error

Combobox with zk error

I have this zk code:

<hbox pack="center" align="top" width="100%" height="400px">
<style src="/widgets/combobox/simple_combobox/css/simple_combo.css" />
<div apply="org.zkoss.bind.BindComposer" height="278px" width="443px"
 viewModel="@id('vm') @init('ShirtViewModel')">
    <separator spacing="40px" />
    <hbox>
        <vlayout>
            <separator/>
            <label value="Color" />
            <combobox id="cmbColor" width="150px"
                  model="@load(vm.names)" selectedItem="@bind(vm.iname)">
            </combobox>
        </vlayout>

    </hbox>
</div>
</hbox>

and i have this java class:

public class ShirtViewModel {
    private String iname, iSize;
    private  List<String> names = Arrays.asList("juan", "marcus", "pedro");
    private  List<String> sizes =  Arrays.asList("big", "little", "medium");

    public List<String> getNames() {
        return names;
    }

    public void setNames(List<String> names) {
        this.names = names;
    }

    public void setSizes(List<String> sizes) {
        this.sizes = sizes;
    }

    public List<String> getSizes() {
        return sizes;
    }

    @Init
    public void init() {
        setIname("juan");
        setiSize("big");
    }

    public String getIname() {
        return iname;
    }

    public void setIname(String iname) {
        this.iname = iname;
    }

    public String getiSize() {
        return iSize;
    }

    public void setiSize(String iSize) {
        this.iSize = iSize;
    }

And i have an error with this code and i do not know why?

The error that i have is, and i have like model my class, i do not know what happen:

org.zkoss.zk.ui.UiException: model of the databind combobox <combobox dyfq8#cmbcolor=""> must be an instanceof of org.zkoss.zkplus.databind.BindingListModel.[juan, marcus, pedro] org.zkoss.zkplus.databind.SelectedComboitemConverter.coerceToUi(SelectedComboitemConverter.java:129)

Somebody can help me, and say me how can i correct my error

Then in the following page is explained better my problem, that is that i have a page with users that i obtain to my database, later, each user has a list of Mno, then, i need a listbox with all Mno in my database (it is a query, and is in my DAO), and i need the in the listbox the selecteditem with the mno that the user has.

in this page: is my problem explained:

 forum. zkoss. org/question/88986/problem-with-listbox-selecteditem/
Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More