cancel
Showing results for 
Search instead for 
Did you mean: 

Change of Tab in Tabstrip through Button

Former Member
0 Kudos

hi,

I want to change tabs through Buttons. I have given two buttons like Next & Previous. I have given contextAttribute "SelectedTab" and bind with selectedTab property of tabstrip. i have done this coding

public void onActionPrevious(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActionPrevious(ServerEvent)

if(wdContext.currentContextElement().getSelectedTab()=="FamilyTab")

{

wdContext.currentContextElement().setSelectedTab("PersonalTab");

}

else if (wdContext.currentContextElement().getSelectedTab()=="AddressTab")

{

wdContext.currentContextElement().setSelectedTab("FamilyTab");

}

It is working fine. But this type of code is not good programming skills becoz there are so many tabs here.

Please give me some other coding so that code will be less and programming skills are good.

Regards

Manish

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I would not compare strings using "==" but using "equals" and also not use a tab strip for implementing a wizard-like UI.

Armin

Former Member
0 Kudos

Hi Armin,

In my application, all views are coming from different local development component projects through DC. Therefore, when I do mapping with the Interface Controller of different Views to Component Controller of Main Projects then I need different valueAttribute like Next , Next1....So, the code given by Manoj is not applicable.

The Problem is such that,

wdContext.currentContextElement().setSelectedTab(wdContext.currentContextElement().getNext());

//wdContext.currentContextElement().setSelectedTab(wdContext.currentContextElement().getNext1());

When I deploy the File, the Control directly goes to the getnext1() Line.

Please help me ....Its very urgent and Necessary for me.

Thanks & Regards

Manish

Former Member
0 Kudos

Honestly, I don't understand your problem.

To implement such a wizard-like UI using a tab strip (which I don't consider a good idea, but that's another issue), you just need to keep the tab IDs in a list and implement two actions that set the context attribute value (to which the tab strip's "selectedTab" property is bound) to the next or previous ID in that list.

What has this to with different DCs etc.?

Armin

Former Member
0 Kudos

Hi,

Are you using different views for each tab??

thanks & regards,

Manoj

Former Member
0 Kudos

Hi Manoj,

Yes, I am using different views for each Tab.

Please provide me the solution .Its urgently needed.

Regards

Manish

Former Member
0 Kudos

Hi,

Then you can have two attrbutes mapped to each view via controller, say previous and next.

Now as you are aware of the design, you can set these attributes in each view's wdDoinit() method.

And on click of the prev and next button you can set the selectedTab property using the attributes previous and next.

Hope this will help you. You can always revert back for further queries.

thanks & regards,

Manoj

Former Member
0 Kudos

Hi Manoj,

I am not getting your points.Can you please describe it.

Regards

Manish

Former Member
0 Kudos

Hi,

As you told that for each tab you have seperate views.

Now create attributes previous and next in your controller and map it to each view.

Suppose you have 3 tabs:

Parent Family Address

In parent tab's view, in wdDoInit() write the following:

wdContext.currentContextElement().setPrevious("");

wdContext.currentContextElement().setNext("FAMILY_TAB_ID");

In family tab's view, in wdDoInit() write the following:

wdContext.currentContextElement().setPrevious("PARENT_TAB_ID");

wdContext.currentContextElement().setNext("ADDRESS_TAB_ID");

In address tab's view, in wdDoInit() write the following:

wdContext.currentContextElement().setPrevious("FAMILY_TAB_ID");

wdContext.currentContextElement().setNext("");

Now in the main view where you have tabs and the previous and next button, you can access the previous and next attributes.

Say onActionPrevious you can write:

wdContext.currentContextElement().setSelectedTab(wdContext.currentContextElement().getPrevious());

and in the same way you can write for onActionNext:

wdContext.currentContextElement().setSelectedTab(wdContext.currentContextElement().getNext());

Hope now you got my point.

thanks & regards,

Manoj

Former Member
0 Kudos

Hi Manoj,

I am very thankful to You.

But My all views are coming from separate local Development Components through the Used DC methods in the Main Project.

Will that coding be applicable for that also?

Thanks& Regards,

Manish

Former Member
0 Kudos

hi,

Ya sure, if you can access those views in your main DC.

thanks & regards,

Manoj

Former Member
0 Kudos

Hi Manoj

But it is not getting the Value of Next attribute from the views.

wdContext.currentContextElement().getNext()

It is giving Null value when I was printing it.

Thanks & Regards

Manish