Hi Anissa,
Currently, you can do this as GlassFish's peTree.jsf does this:
// Find the old component
getUIComponent("$requestParameter{updateTreeNode}"
component=>$attribute{oldComp});
setAttribute(key="parent" value="#{oldComp.parent}");
// Replace it with something temporary to hold position
// Needed, or it it will just find the old one vs. create it
createComponent(type="staticText" component=>$attribute{temp});
replaceUIComponent(old="${oldComp}" new="$attribute{temp}");
// Rengenerate it
getLayoutComponent(clientId="$requestParameter{updateTreeNode}"
component=>$attribute{desc});
buildUIComponentTree(layoutElement="$attribute{desc}"
parent="#{parent}" result=>$attribute{newComp});
replaceUIComponent(old="${temp}" new="$attribute{newComp}");
I could probably wrap this into a single handler, but this is what you
have to do right now. JSF maintains an ordered List of children...
that's why you can't just remove it and recreate it. You have to create
a placeholder (perhaps you could just give the existing component a new
"id"). Then you have to build it using the LayoutComponent meta-data
for JSFTemplating (which stores whatever you defined in your .jsf
file). Finally you have to swap the newly created UIComponent (which is
at the end of the List of child UIComponents) for the place-holder
component that you created earlier.
I hope this is what you're looking for. :)
Good luck,
Ken
Anissa Lam wrote:
>
> There are some attributes in a component that gets evaluated only when
> the component is created, not during refresh. So, when the page
> refresh, the component exists and so won't go through the creation
> again.
> This seems to be the case of the 'text' of a button. I also need to
> re-create the jmaki:chart component with new data set.
> I am sure there is a way to force the recreate, but not sure how.
>
> thanks
> Anissa.