As I explained earlier, getAncestor() does not provide an override that takes a
String, only a Class. I had suggested giving your Accordion an ID - did you try
that?
If your accordion panels are not defined in the same WTKX file as the accordion
itself, then an ID won't work and you will have to use getAncestor(). I haven't
tried passing a Class instance in JavaScript, but I imagine that it is
possible. You should be able to do something like:
var accordion = button.getAncestor(org.apache.pivot.wtk.Accordion.class);
I'll take a look at adding a String override to getAncestor() for Pivot 2.0.
G
On Dec 3, 2010, at 2:39 AM, MSafiri wrote:
>
> Dear All,
>
> We started to work on the accordion based GUI part of our application.
> Followed the Tutorial, did all the modifications. However, when the
> individual panels are loaded, the error message below appears:
>
> javax.script.ScriptException:
> sun.org.mozilla.javascript.internal.EvaluatorException: erreur de syntaxe
> (<Unknown source>#3) in <Unknown source> at line number 3
>
> accordion.selectedIndex += 1;
> }
>
> Here is the code of the PushButton used to advance to the next panel:
>
> <PushButton wtkx:id="nextButton" buttonData="Next"
> styles="{minimumAspectRatio:3}">
> <buttonPressListeners>
> <wtkx:script>
> importPackage(org.apache.pivot.wtk);
> function buttonPressed(button) {
> <!--- var accordion =
> button.getAncestor("org.apache.pivot.wtk.Accordion"); -->
> accordion.selectedIndex += 1;
> }
> </wtkx:script>
> </buttonPressListeners>
> </PushButton>
>
> If the variable declaration line is included, another error message appears.
>
> I uploaded the complete code of one of the panel to show the structure.
>
> http://apache-pivot-users.399431.n3.nabble.com/file/n2010365/cstDelegatorDialogSummary.wtkx
> cstDelegatorDialogSummary.wtkx
>
> Can anyone help out what can be the problem?
>
> Thanks for the help,
>
> MSafiri
> --
> View this message in context:
> http://apache-pivot-users.399431.n3.nabble.com/Script-Problem-Accordion-tp1966316p2010365.html
> Sent from the Apache Pivot - Users mailing list archive at Nabble.com.