0

Load and Retrieve the Values In Combobox

asked 2010-01-15 03:06:28 +0800

techvts gravatar image techvts
120 2 5

hi,
i wanted to load the combo box with the name of countries from the database what i did is stored the name in string array and casted it to list model like.

<zscript><![CDATA[
CountryService conSvc = new CountryService();
ListModel conset = new SimpleListModel(conSvc.getCountry());
]]>
</zscript>

conSvc.getCountry() return array,

and used it has

<combobox id="countryCmb" width="150px" model="${strset}" constraint="no empty" />

by this i get all the name in the combo box, but i want to know whether this is the right method.

also when i retrieve the values while editing the record i am not able to select default value from the combo list,
i used the same above method to load the combo,

<combobox id="bunitCmb" width="150px" model="${strset}" constraint="no empty" value=${country.Name}/>
by this i get only one name of the country by which i have saved the record.

what should be done so that i can get all the list and selected with one which i have saved the record.

thanks in advance.

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2010-01-21 00:27:14 +0800

techvts gravatar image techvts
120 2 5

hi,
Can any one help me to get the solution for above problem.

link publish delete flag offensive edit

answered 2010-01-24 17:25:29 +0800

samchuang gravatar image samchuang
4084 4

Hi

using listmodel is the right choice, if you want to change the the model's value with DB, you could use other ListModel, SimpleListModel doesn't change it's value dynamic

link publish delete flag offensive edit

answered 2010-01-28 06:19:15 +0800

techvts gravatar image techvts
120 2 5

updated 2010-01-28 06:19:32 +0800

@ samchuang

Thanks for your reply.

link publish delete flag offensive edit
Your reply
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: 2010-01-15 03:06:28 +0800

Seen: 642 times

Last updated: Jan 28 '10

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