java - Wicket: Palette set default selected -
i'm trying implement palette. seek set default selected list it's empty.
mylists:
// here set of categorys in grouping set<category> selectedcategorysset = new hashset<category>(); selectedcategorysset = group.getcategorys(); // here categorys exists list<category> listcategory = new arraylist<category>(); listcategory = catdao.getall(category.class); list<category> selectedcats = new arraylist<category>(); list<category> tmplist = new arraylist<category>(); // palette doesnt take set added set list selectedcats.addall(selectedcategorysset); // here delete every category whole list selected (stored in temporary list) for(category catlist:listcategory){ for(category cat:selectedcategorysset){ if(cat.getcategoryid() == catlist.getcategoryid()){ tmplist.add(catlist); } } } listcategory.removeall(tmplist); /* 2 multiple select boxes switches items between each other */ ichoicerenderer<category> renderer = new choicerenderer<category>("title","categoryid"); final palette<category> palette = new palette<category>("palette", new listmodel<category>(selectedcats), new collectionmodel<category>(listcategory), renderer, 10, false);
i debugged code, works selected values empty.
here image of debugged variables:
but selected field still empty!
what doing wrong?
you should not delete every category whole list selected
.
palette component must store whole list of values in it's choicesmodel
listcategory
in code.
so, remove next code implementation:
class="lang-java prettyprint-override">for(category catlist:listcategory){ for(category cat:selectedcategorysset){ if(cat.getcategoryid() == catlist.getcategoryid()){ tmplist.add(catlist); } } } listcategory.removeall(tmplist);
java wicket
No comments:
Post a Comment