0

Hibernate FK and listbox

asked 2011-02-27 11:59:06 +0800

fusion35 gravatar image fusion35
237 2 5

updated 2011-02-27 12:01:56 +0800

I'm not able to get the selectedItem to work for a listbox

ZUL :

<listbox mold="select" id="categoriesProduit" selectedItem="@{produits.categoriesProduit}"/>

Hibernate Mapping :

private CategoriesProduit categoriesProduit;

	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "No_categorie", nullable = false)
	public CategoriesProduit getCategoriesProduit() {
		return this.categoriesProduit;
	}

	public void setCategoriesProduit(CategoriesProduit categoriesProduit) {
		this.categoriesProduit = categoriesProduit;
	}

Model and renderer

        BindingListModelList modelCategory = new BindingListModelList(CommonDAO.getAllRows(CategoriesProduit.class), false);
        categoriesProduit.setModel(modelCategory);
        categoriesProduit.setItemRenderer(new ListitemRenderer() {

            public void render(Listitem listItem, Object data) throws Exception {
            	CategoriesProduit categoriesProduit = (CategoriesProduit) data;
                listItem.setValue(data);
                new Listcell(categoriesProduit.getDescriptionAnglais()).setParent(listItem);
            }

        });


regards

Devinder

delete flag offensive retag edit
Be the first one to reply this discussion!
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

RSS

Stats

Asked: 2011-02-27 11:59:06 +0800

Seen: 125 times

Last updated: Feb 27 '11

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