0

combobox auto drop java bean [closed]

asked 2013-06-07 09:04:31 +0800

Mangapathi gravatar image Mangapathi
11 3

Hi,

I want to render list of data in combobox for which auto drop is set to true. The data I will fetch from database and prepare a collection list of an java bean. In that java bean I have two variables value, label. I will set values to these two variables while fetching from database itself. Now I want to render this collection in a combobox.

Can anyone suggest how to achieve this ?

thanks, Mangapathi

delete flag offensive retag edit

The question has been closed for the following reason "the question is answered, right answer was accepted" by sjoshi
close date 2013-06-14 09:57:43

3 Answers

Sort by ยป oldest newest most voted
0

answered 2013-06-07 09:34:06 +0800

sjoshi gravatar image sjoshi flag of India
3493 1 8
http://zkframeworkhint.bl...

See these two link it will help you to resolve the issue... zk-combobox-with-selectoption

zk-combobox-with-item-rendered

link publish delete flag offensive edit
0

answered 2013-06-07 11:36:23 +0800

Mangapathi gravatar image Mangapathi
11 3

Hi joshi, thanks for your response. I have a class which extends GenericForwardComposer<component>. In this class I had written a common method to fill the combobox without using renderer(just appeneding items). I am using this class as parent class for all my controller classes. I will invoke this method from respective controller to fill the comboboxes. Now I want to apply the atuodrop option. For doing this I had modified my code as below

public void fillComboBox(Combobox combobox, List<ValueLabel> list) {
    combobox.setModel(new SimpleListModel(list) {
        protected boolean inSubModel(Object key, Object value) {
            String idx = key.toString();
            ValueLabel myItem = (ValueLabel)value;
            return idx.length() > 0 && myItem.getLabel().startsWith(idx);
        }
    });

    combobox.setItemRenderer(new ComboitemRenderer () {
        public void render(Comboitem item, Object data, int count) throws Exception {
            ValueLabel valueLabel = (ValueLabel)data;
            item.setLabel(valueLabel.getLabel());
            item.setValue(valueLabel.getValue());
        }
    });

}

But the above code is not working.

link publish delete flag offensive edit

Comments

WHat issue you are geting and Can you test my code as well in your application?

sjoshi ( 2013-06-07 11:58:46 +0800 )edit
0

answered 2013-06-07 12:28:52 +0800

Mangapathi gravatar image Mangapathi
11 3

Hi Joshi, I am not getting any issue, the execution was entering into inSubModel method but not going into the render method. Why it was skipping at that line I didnot understand. Is there any thing wrong in my above code.

link publish delete flag offensive edit

Comments

THen it mean your list is empty ,try to put debug point inside inSubModel() method and check if debugger coming here

sjoshi ( 2013-06-07 13:05:02 +0800 )edit

Hi Joshi, I had checked and printed the values in log, values are getting printed. but after inSubModel method execution was not entering into render method.I put a debug point in render method also.

Mangapathi ( 2013-06-07 13:30:38 +0800 )edit

Hi Joshi, thanks for your suggestions, I got resolved the issue. Code cleanup is the problem.

Mangapathi ( 2013-06-14 07:13:04 +0800 )edit

Ok gr8 Accept the answer and close this question :)

sjoshi ( 2013-06-14 07:28:50 +0800 )edit

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-06-07 09:04:31 +0800

Seen: 20 times

Last updated: Jun 07 '13

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