1

Can't Retrieve Value Combobox from zk listbox

asked 2016-09-20 02:38:39 +0800

seksan44 gravatar image seksan44
9 3

updated 2016-09-20 02:43:49 +0800

This code

            listData.setModel(new ListModelList<Course>(this.list));
    listData.setItemRenderer(new ListitemRenderer<Course>(){

        @Override
        public void render(final Listitem item,final Course data,final int index)
                throws Exception {
            // TODO Auto-generated method stub

            Listcell seq = new Listcell((index+1)+"");
            item.appendChild(seq);

            Listcell code = new Listcell(data.getId());
            item.appendChild(code);



                grade = new Combobox();
                grade.appendItem("A");
                grade.appendItem("B");
                grade.appendItem("C");
                grade.appendItem("D");
                grade.appendItem("F");


            Listcell gradeS = new Listcell();
            gradeS.appendChild(grade);
            item.appendChild(gradeS);

            selectGrade.addEventListener(Events.ON_SELECT, new EventListener<Event>(){

                @Override
                public void onEvent(Event event) throws Exception {
                    // TODO Auto-generated method stub

                    selectGrade.getModel();
                    //ListModelList lists = (ListModelList)selectGrade.getModel();
                    String g = selectGrade.getValue();


                    System.out.println(g);



                }
            });
        }
    });
}
delete flag offensive retag edit

Comments

Greetz chill. thx

seksan44 ( 2016-09-20 06:42:41 +0800 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2016-09-20 06:11:46 +0800

chillworld gravatar image chillworld flag of Belgium
5322 4 9
https://github.com/chillw...

Well,

First of all your code is just broken.
selectGrade is never initialized in your code.
But I think I get what you want to do.

Now, it's never possible to ask for a value if you never set a value.

What you can do :

grade.getSelectedItem().getLabel();

Greetz chill.

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-09-20 02:38:39 +0800

Seen: 19 times

Last updated: Sep 20 '16

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