hiding specific tab panels based on value

Hi all!

need your help again. I have a layout with about 8 tabs in the tab panel.

When a field is of a certain value, i want only 7 tab panels displayed (one of the tab panel is hidden), if it’s another value, i want all 8 tabs to be visible. is there a way to control that in servoy?

thanks,
sammy

sammyzheng:
When a field is of a certain value, i want only 7 tab panels displayed (one of the tab panel is hidden), if it’s another value, i want all 8 tabs to be visible. is there a way to control that in servoy?

Hi,

Yes, with the “removeTabAt(number index)” method of the TabPanel. The
limitation is that you can remove relation based tabs but you can only add relationless tabs with addTab(…).

In case you need to use the removed tab latter, don’t remove it, disable it:

switch( globals.gTABreference ){
case 1:
  elements.tabs_70.setTabEnabled(1, false);
  elements.tabs_70.setTabEnabled(2, true);
  elements.tabs_70.tabIndex = 2;
  break;
case 2:
  elements.tabs_70.setTabEnabled(2, false);
  elements.tabs_70.setTabEnabled(1, true);
  elements.tabs_70.tabIndex = 1;
  break;
default:
  elements.tabs_70.setTabEnabled(2, true);
  elements.tabs_70.setTabEnabled(1, true);
}

HTH,
Miguel

mjekl:

sammyzheng:
When a field is of a certain value, i want only 7 tab panels displayed (one of the tab panel is hidden), if it’s another value, i want all 8 tabs to be visible. is there a way to control that in servoy?

Hi,

Yes, with the “removeTabAt(number index)” method of the TabPanel. The
limitation is that you can remove relation based tabs but you can only add relationless tabs with addTab(…).

In case you need to use the removed tab latter, don’t remove it, disable it:

switch( globals.gTABreference ){

case 1:
elements.tabs_70.setTabEnabled(1, false);
elements.tabs_70.setTabEnabled(2, true);
elements.tabs_70.tabIndex = 2;
break;
case 2:
elements.tabs_70.setTabEnabled(2, false);
elements.tabs_70.setTabEnabled(1, true);
elements.tabs_70.tabIndex = 1;
break;
default:
elements.tabs_70.setTabEnabled(2, true);
elements.tabs_70.setTabEnabled(1, true);
}




HTH,
Miguel

Thanks for the pointer. Now that I’ve removed the tab, I need to be able to set the view of the tab back. Is there a command does the opposite of removing the tabs?

can anyone help with this question?

Now that I’ve removed the tab, I need to be able to set the view of the tab back. Is there a command does the opposite of removing the tabs? (like show all tabs?)

read the above posting:

Yes, with the “removeTabAt(number index)” method of the TabPanel. The
limitation is that you can remove relation based tabs but you can only add relationless tabs with addTab(…).

That says it all.

HJK:
read the above posting:

Yes, with the “removeTabAt(number index)” method of the TabPanel. The
limitation is that you can remove relation based tabs but you can only add relationless tabs with addTab(…).

That says it all.

doh! thanks for pointing that out.