Hi folks,

I'm trying to do a conditional tab switching method. How can I prevent to switch to the second tab if, let's say, on the first tab any of conditions are not met?

I tried to use the tabbedPanel 'ignoreChanges="Y"' action attribute, and I've created the success and unsucces method, but the tab changed anyway.

  param1 := api_component.getvaluetx('panelParam.taParam1');
  param2 := api_component.getvaluetx('panelParam.taParam2');

  IF param1 IS NULL OR param2 IS NULL THEN
    api_alert.show(in_alertName_tx => 'showAlert');
    api_tabbedpanel.setCurrentTab(in_tabbedPanelName_tx => 'tabbedPanelCond', in_tabName_tx => 'tab_First');
  ELSE
    api_tabbedpanel.setCurrentTab(in_tabbedPanelName_tx => 'tabbedPanelCond', in_tabName_tx => 'tab_Second');
  END IF;

Thanks in advance!

asked 23 Nov '15, 10:23

S7ilA's gravatar image

S7ilA
152
accept rate: 0%


Hi Szilard,

It is true the the tab changes first. The event we are calling is postTabChanged after all. But I was able to not see the grid in my local test. Did you try setting the current tab to the first one before showing the alert?

api_tabbedpanel.setcurrenttab('tabbedPanel', 1); 
api_alert.show('alert1');

With this code I don't see the grid in the second tab.

Finally, if this doesn't work for you either ( I think it should) I am not sure if the tabbedPanel is the right way to implement what you have in mind. Maybe a button or a hyperlink can achieve what you want in a better way?

Hope this helps.

Kind Regards,
Yalim

link

answered 24 Nov '15, 02:15

Yalim%20Gerger's gravatar image

Yalim Gerger ♦♦
1.8k5
accept rate: 15%

edited 24 Nov '15, 02:15

Hi Yalim,

It works fine! (And the solution is very obvious...)

And you are right, it's not the best way to solve the described problem. I'm just trying to imitate the behavior of an existing application.

Thank you anyway!

(24 Nov '15, 03:59) S7ilA

Hi Szilard,

Cool. Happy to hear that the issue is resolved. Thank you very much for your interest in Formspider! :-)

Kind Regards,
Yalim

(24 Nov '15, 04:01) Yalim ♦♦

Hi,

You can use the api_tabbedPanel.setCurrentTab API in the tabChanged event to take the user back to the tab she was on.

For example consider the tabbedPanel named tabbedPanel1 with the following content:

<tabbedPanel>
  <events>
    <postTabChanged action="doTabChanged" ></postTabChanged>
  </events>
  <tab panelName="panel1" title="Tab 1" order="1" ></tab>
  <tab panelName="panel2" title="Tab 2" order="2"></tab>
</tabbedPanel>

Calling

api_tabbedpanel.setcurrenttab('tabbedPanel1', 1);

in the doTabChanged action causes the application to always stay on Tab 1.

Hope this helps.

Kind Regards,
Yalim

link

answered 23 Nov '15, 10:50

Yalim%20Gerger's gravatar image

Yalim Gerger ♦♦
1.8k5
accept rate: 15%

edited 23 Nov '15, 10:51

Hi Yalim,

I tried the postTabChanged event. Unfortunately, the tab change happens anyway. It is true, after evaluating the conditions, the first page will be active again.

My original goal was to set the filtering conditions on the first tab, and the grid on the second tab (and the datasource) would use these conditions to determine the list of records.

With your solution the second tab and the empty grid appears behind the alert window.

So, there is no way to deny the tab change, before it happens, if the conditions don't met?

Best Regards, Szilard

link

answered 23 Nov '15, 17:37

S7ilA's gravatar image

S7ilA
152
accept rate: 0%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×3

Asked: 23 Nov '15, 10:23

Seen: 675 times

Last updated: 24 Nov '15, 04:08


© Copyright Gerger 2017