Page 1 of 1

Switching tabs programmatically

PostPosted: Mon Mar 18, 2013 6:05 am
by maria.kyselova
Hi All,

A simple operation throws "java.lang.ArrayIndexOutOfBoundsException: Array index out of range: 1" when I switch between the tabs on a tabpanel.
The tabpanel has two tabs referring to the same table view form through two different relations.
If I remove either of the tabs - the form looks fine.
However, if I execute the line below, the exception is thrown:
Code: Select all
elements.tab_report_lists.tabIndex = elements.tab_report_lists.getMaxTabIndex();


Setting the tab index with a number (2) or the tab name as a string produce the same effect.

Bug?

Cheers,
Maria

Re: Switching tabs programmatically

PostPosted: Mon Mar 18, 2013 1:24 pm
by Andrei Costescu
This sounds a bit strange to me.
I'm thinking: if you have the first tab open with a set of related records, then you select records/work with those records, then you click on the second tab => another set of related records will be loaded. When you come back to the first tab should the other related set of records be re-loaded into the form? Selection kept and all?

I guess it would work if you used a clone for each tab instead of the same form instance. (either at designtime or at runtime with solutionModel)
But why do you need the same form in both tabs?

Re: Switching tabs programmatically

PostPosted: Wed Mar 20, 2013 3:42 am
by maria.kyselova
Andrei Costescu wrote:This sounds a bit strange to me.
I'm thinking: if you have the first tab open with a set of related records, then you select records/work with those records, then you click on the second tab => another set of related records will be loaded. When you come back to the first tab should the other related set of records be re-loaded into the form? Selection kept and all?

I guess it would work if you used a clone for each tab instead of the same form instance. (either at designtime or at runtime with solutionModel)
But why do you need the same form in both tabs?


Hi Andrei,
I need the same form in both tabs because one of them displays records filtered by two columns and the other one filters records only by one column. Each tab has a different relation.

Everything should work just fine, I'm not loading anything manually or keeping track of record indexes.
We have a similar thing in other places and it works fine. Just not for this one.

Will keep digging.

Re: Switching tabs programmatically

PostPosted: Wed Mar 20, 2013 9:51 am
by Andrei Costescu
And the only thing that doesn't work is changing the tab through scripting? Otherwise it works fine - changing tabs using mouse for example (or are you using hidden tabs)?

What version of Servoy do you use?
You could also check the app. server log file for for any errors before executing the tab-switch script (maybe something happens and the tab-panel is not constructed correctly).

Re: Switching tabs programmatically

PostPosted: Wed Mar 27, 2013 4:04 am
by maria.kyselova
Andrei Costescu wrote:And the only thing that doesn't work is changing the tab through scripting? Otherwise it works fine - changing tabs using mouse for example (or are you using hidden tabs)?

What version of Servoy do you use?
You could also check the app. server log file for for any errors before executing the tab-switch script (maybe something happens and the tab-panel is not constructed correctly).


Hrm.. I didn't try to change tabs with the mouse.
I found a way to filter my related foundset with a help of only one relation, so the requirement is not there any more, Andrei.
Thank you for your input. I'll come back here if the issue comes up again.