on 01-05-2008 10:06 AM
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
I would not compare strings using "==" but using "equals" and also not use a tab strip for implementing a wizard-like UI.
Armin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
Hi,
Are you using different views for each tab??
thanks & regards,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.