Hi,

>From a database I am retrieving two columns, the label for the radio and a
boolean value to say whether or not it should be selected. I have written
the code below to get the values from the database, the ObjectSelect class
contains the object (in this case the string label) and selected which is a
boolean value. When the page loads the none of the radio choices are
selected. 

Is it possible to set the default value in this way, if not how can it be
done?

-------------------------------------CODE--------------------------------------------
//Add query type radio group
queryTypes = new LoadableDetachableModel() {
        @Override
        protected Object load() {
                
QueryTypeWrapper.setObjects(queryDefDao.getQueryType(queryDefId));
                return QueryTypeWrapper.getObjects();
        }
};
           
//Generate list of groups with checkboxes
final RadioGroup radioGroup = new RadioGroup("radioGroup", queryTypes);
f.add(radioGroup);
ListView radioList = new ListView("queryTypes", queryTypes)
{
        protected void populateItem(ListItem item)
        {
                ObjectSelect os = (ObjectSelect) item.getModelObject();
                item.setModel(new CompoundPropertyModel(os));
                item.add(new Radio("selected"));
                item.add(new Label("object"));
        }

};
radioGroup.add(radioList);
-------------------------------------CODE--------------------------------------------

Thanks in advanced
Ross
-- 
View this message in context: 
http://www.nabble.com/RadioGroup-set-selection-from-database-results-tp20130427p20130427.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to