View Full Version : Refresh/Reload radio group content

30 Sep 2010, 5:59 AM

I want to know if there is a way to refresh/reload a part of a formPanel. I'm creating dynamically radio buttons (Radio) in a radio group (RadioGroup). These radio buttons have image as label and each image is uploaded by a form This form and the radio group are within another form.

My question is how to refresh/reload the radio group after an upload in order to have the new radio button displayed.


30 Sep 2010, 6:01 AM
I dont really understand what you are saying. Can youplease explain in detail what you want to do?

You want to add new Radio instances to a RadioGroup after rendering? That wont work, there is also an assertion.

30 Sep 2010, 6:09 AM
My radio group is to choose icons. When I first display my form, only the icons in database are coupled to radio buttons and displayed. I want the user to be able to add other icons if he doesn't want those displayed. So, he can upload his file and add save it in DB.

What I want is, once he saves his icon, it can be viewed in the radio group next to the others without relaunching my page

30 Sep 2010, 6:11 AM
I cannot answer this without knowing anything on your app.

How do you display the icons in the first place?

30 Sep 2010, 6:23 AM
By getting all icons by a RPC call. When this call is successful, I create dynamically the radio group

noIcon = new Radio();
noIcon.setStyleAttribute("paddingLeft", "5px");

for (ModelDate resource : iconViews) {
Radio icon = new Radio();
icon.setStyleAttribute("paddingLeft", "5px");
icon.setBoxLabel(showResource(resource.getIdentifier().toString(), mimeType));

showResource() is a servlet which renders the icon.

30 Sep 2010, 6:25 AM
showResource is probably not a servlet but a method.

So you simple call setBoxLabel. You can call that again after getting the correct icon.

30 Sep 2010, 6:31 AM
Exactly, showResource() is the method which sets the path used to call the servlet. I don't really understand what you mean with the 2 last sentences

30 Sep 2010, 6:33 AM
When you got your new image from your server that you want to show, than simple call icon.setBoxLabel(mystring); again.

30 Sep 2010, 6:39 AM
That is obvious and that's what I'm doing. But, once I upload my file, I call the method above which is supposed to get all icons and show them.

When I reload my page, ther is no problem and my new icon is displayed. But I don't want a reloading before getting the new icon added. And that's my problem...

30 Sep 2010, 6:45 AM
No you are not doing that.

You showed me the code how you initially create the radios with the wrong images. So somewhere you upload an image and after that finishes, you want to show the new icon. Than you need to call setBoxLabel again, with the new icon as html formated string.

30 Sep 2010, 6:50 AM
The code I've showed you initially create the radios with images in DB. When the user upload an image, I want to show the new icon next to the others.

30 Sep 2010, 6:53 AM
Yes that is what i am telling you.

After the upload finished, simple set a new BoxLabel with the new icon.

30 Sep 2010, 6:56 AM
Ok thanks. I'll try it