The method which I've discovered works best for me is to use Firebug and ADF's client side 'findComponent' function.
Step 1: Be sure to have Firebug installed. I currently am using Firefox 2.0.0.16 with Firebug 1.0.5, though this should work with any version of Firefox\Firebug.
Step 2: Determine the client id, including the full naming container path, of your target. This can be done by opening the HTML tab of the Firebug console and doing a search for the component's declared id. If you have a component which is several naming containers deep, this can be a lot easier than tracing the path through the jsp pages. We'll call this the target id from here on.
page:tmplt:rgn:panCol:tableA
Step 3: Determine the id, including the full naming container path, of your trigger. Use the same method as in Step 2.
page:tmplt:buttonA
Step 4: Paste these two ids into a text file and determine their last point of commonality. In the example below, the target and trigger share 'page:tmplt' as their base path. This means that this part of the path can be ignored, because these components will be relative to each other at this point.
page:tmplt:rgnA:panCol:tableA [target]
page:tmplt:rgnB:buttonA [trigger]
Step 5: Determine what the relative path of the trigger from the target should be. This can be tricky, but at this point all you really need is a good guess that we can test in the next step. For this example we can see that the trigger is up two naming containers and then down one.
So, for the first naming container we climb up from the target, we begin our relative path with two colons (if we were to put only one, we would be signaling that our path is absolute, and should start from the page root. No colons would be signaling to search for other components that are under the same naming container path as the target).
::
gets us to -> page:tmplt:rgnA(Keep in mind that findComponent really starts from the current component's parent naming container if it's not a naming container itself OR itself, if it is a naming container. In this case the target is not a naming container, so the search begins from 'panCol', the target's parent naming container.)
To get above the next naming container, we add another :
:::
gets us to -> page:tmpltNow we are at our point of commonality, and we need to begin to traverse down the naming container path into a different branch. Appending the down stream naming container path gets us to the level of our trigger.
:::rgnB
gets us to -> page:tmplt:rgnBNow we just need to append the id of the trigger component. My use of id here refers to the id attribute that is declared on the component in the jsp. The client id of the component includes the full naming container path, as we saw when searching for the component in Step 1.
:::rgnB:buttonA
gets us to -> page:tmplt:rgnB:buttonAStep 6: Now we use the ADF javascript method, findComponent, to get a handle to the target component and verify that we have calculated the the relative client id accurately. Open up the console tab and pass in the target id as the only parameter to the findComponent function.
AdfPage.PAGE.findComponent('page:tmplt:rgnA:panCol:tableA');
This should return an object; in my local example this returns an AdfRichTable object. Now, from this object we will use the same function and pass in the relative path we determined in Step 4.
AdfPage.PAGE.findComponent('page:tmplt:rgnA:panCol:tableA).findComponent(':::rgnB:buttonA');
If this function returns our trigger, then we know we have the correct relative path, :::rgnB:buttonA, to assign as the value for the partialTrigger attribute on our target. If not, we can test other paths rather quickly by plugging in different trigger ids. Most of my errors are either too few or too many leading colons, and I can easily test those by using this function.
2 comments:
Thanks for your article. It got me thinking about how to track down an outputText buried in the footer of a column. I don't have FireFox on my work PC, so a very simple work-around to find the resolved ID of the target is to just add a clientListener to the target. In the javascript, do alert(event.getSource()); Once identified, remove the extraneous junk.
Thanks it helped me understand how the whole thing was working
Post a Comment