FYI this was recently added as a JIRA issue (MYFACES-360) and has just been fixed.
sean On 7/25/05, Surrey Hughes <[EMAIL PROTECTED]> wrote: > The expand control is inside the guts of the tree2 component. In fact the > constructor of the tree2 creates the expand control commandlink. That means > there is no way to access it through tags on your page. You'd have to fiddle > with it after the tree2 constructor has fired but before it is rendered. > Luckily it is a public property (well it has a public getter) so you can > alter it's properties through code. Not a really nice way to do it. One way > you could do it, though I haven't given it a go yet, is to write your own > render kit and fiddle with it then according to params you set or a facet? > You could also just extend it and override the tree2 constructor and add an > extra attribute to the tag. Just depends on how you want to go. > > I'm using a phase listener at the moment because I've already wasted three > days (long ones too) trying to figure out the expand control. > > Surrey. > > > -----Original Message----- > From: CONNER, BRENDAN (SBCSI) [mailto:[EMAIL PROTECTED] > Sent: Tue 26/07/2005 12:48 AM > To: MyFaces Discussion > Subject: RE: Tree2 expand Control problem when in a form > > Hi Surrey, > > Thanks for the insight. Have you had any luck attaching an > actionListener to the expandControl's commandLink? We're trying to get > an actionListener attached so we can do lazy fetches of the children on > an as-needed basis. However, we've only been able to attach an > actionListener to the commandLink that we specify inside the tree (not > to the expandControl itself). > > - Brendan > > -----Original Message----- > From: Surrey Hughes [mailto:[EMAIL PROTECTED] > Sent: Monday, July 25, 2005 4:20 AM > To: [email protected] > Subject: Tree2 expand Control problem when in a form > > > > > Hi, > I've found the x:tree2 tag creates an HtmlTree that contains a property > called expandControl. The expand control is set as a new commandLink. > It is rendered using an image of a plus or a minus and expands or > collapses the node. The commandLink component renders a bunch of > javascript or a url query string (depending on if you allow javascript > in web.xml) that uses either the form containing the link or it creates > a dummy form and submits that as part of its action. Now the problem > with tree2 is that the expandControl commandLink has no parent as it is > created as a property of the HtmlTree. That means during rending no > form is detected even if the tree2 is in a form. As you could well > imagine, that means if you are relying on the form fields to be > submitted correctly when you expand or contract a server toggled tree > you are out of luck. > > The solution: > Well I guess I'd change tree2 so it creates a commandLink and sets the > parent as the tree component. > But I didn't do that. Instead I created a PhaseListener that listend to > the restore view phase where it recursively goes through the UIViewRoot > and for each HtmlTree I set the expandControl parent to be the tree it > is housed in. > This is an imperfect solution but at least I can get on with the rest of > my app. > > Yeah, it sent me insane and kept me back at work for many long hours. > > I hope this helps someone else outthere. Also if anyone wants to fix > the tree2 component then feel free :) > > Surrey. > > > > > >

