0

How do I set selectedIndex in this case

asked 2020-03-01 22:35:56 +0800

HotCat gravatar image HotCat
1 1

updated 2020-03-02 11:22:00 +0800

cor3000 gravatar image cor3000
5114 2 7
ZK Team

Here is my code

ArrayList<Cat> cats = new ArrayList<Cat>(); 
cats.add(new Cat("Mary", "1"));
cats.add(new Cat("Mark", "2"));
ListModelList(cats, true));
int i = cmbCat.getItemCount(); // i is 0
cmbCat.setSelectedIndex(0);

cmbCat is a Combobox. After I set the model of cmbCat, I want to set the SelectedIndex always fail. How can I achieve this? And why?

delete flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2020-03-02 15:31:29 +0800

hawk gravatar image hawk
2620 1 5
http://hawkphoenix.blogsp... ZK Team

Please read Default_Selection

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

RSS

Stats

Asked: 2020-03-01 22:35:56 +0800

Seen: 6 times

Last updated: Mar 02

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