on 08-08-2005 9:36 AM
hi all
i have a requirement in my application
i have view with two UI element one is a Table i.e., a Nested Tree Table which is on top and a DropDownKey list below the table. The Dropdown contains Student, Employee, Faculty and so on. When i select a particular key element in dropdown corresponding data should be displayed in the table above.
what i think for this i need to go for GridLayout Viewset
and my problem should i make 3 different tables for different keys or else one table with 3 different java classes i.e., whenever i select a key that corresponding data should be loaded dynamically into the table at runtime.
please guide me
Thanks and Regards
khaja
Hi Mohammad,
You can create three tables and depending on the key selected you can make that particular table visible by creating simple type(for each table) with visibility property(in the uidefinitions) and then binding with visibility of the table and then changing this visibility to WDVisibility.VISIBLE at run time.
Hope this helps.
Regards,
Jaydeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mohammad,
you can create a tabstrip with three tabs in the upper part of your view. In each tabstrip create one table each, and create the DropdownByKey UI element in the bottom part. Create Action object for displaying different TabStrip and bind it to the onSelect property of the list box. Depending upon the List selection open the corresponding TabStrip i.e. the corresponding Table.
Regards,
Shubhadip
In the TabStrip UI elements property you have one property called selectedTab. This contains the name of the Tab which will be shown as selected in the runtime. So bind this property to a String type context attribute of your view. Then from the action handler method of the onSelect method of DropdownByKey UI elelement set the selected tab depending upon your selected value.
Say your two tabs are named as TabStudent and TabTeacher. And teh context attribute bound with the selectedTab proerty of TabStrip is mySelectedTab, then from the ListBox's action handler you read the selected value. Then depending upon the value do something like this
if(listValue.equals("Student"))
wdContext.currentContextElement().setMySelectedTab("StudenTab");
else
wdContext.currentContextElement().setMySelectedTab("teacherTab");
Now this Tabs will contain your tables.. and as you are changing the tabs dynamically you dont need to hide any tables by code.. whichever tab will be displayed its own table will be displayed.
Regards,
Shubhadip
hi Shubhadip
thanks for your guidance but it did work out im getting Tab0 in my dropdown when i select Student and Tab1 in my dropdown when i select Employee but the tables are not changing accordingly . i will explain clearly what i did
first ive created a TabStrip in my topview of Gridlayout viewset. in that tabstrip ive create 2 Tabs named Tab0 and Tab1 which are tables and in the context of TabStrip ive two values nodes Std and Emp.and in the properties of Tabstrip view i have option selectedTab with Tab0 and Tab1 as options
Next in the second view which is below the Tabstrip view
i created a dropdownkey ui with Select as context value attribute.then event handler go
could u please go through and find out what went wrong with me
implementation of Dropdownkey listview
public void onActiongo(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
{
//@@begin onActiongo(ServerEvent)
String str1=wdContext.currentContextElement().getSelect();
if (str1.equalsIgnoreCase("Student"))
{
wdContext.currentContextElement().setSelect("Tab0");
}
else
{
wdContext.currentContextElement().setSelect("Tab1");
}
regards
Hi Sravan,
when you are saying
wdContext.currentContextElement().setSelect("Tab0");
its trying to set a Key "Tab0" in the listBox, NOT in the TabStrip. You could have placed both TabStrip and ListBox in the same view in order avoid complicacy. If you put two items in two views you need to communicate between them via Component Controller. Better, you put the TabStrip and the ListBox both in one view, one after another or one below another.
1. Now create just one Context Attribute for the TabStrip (not two like Std and Emp).
2. Name it something like mySelectedTab.
3. Bind this attribute with the selectedTab property of the TabStrip UI element.
4. Now write
if (str1.equalsIgnoreCase("Student"))
{
wdContext.currentContextElement().setMySelectedTab("Tab0");
}
else
{
wdContext.currentContextElement().setMySelectedTab("Tab1");
}
It should work now...
Regards,
Shubhadip
Hi Mohammad,
if you use two views then also the context structure should be same as I declared. Now u have to set the selectedStep attribute value from the second view i.e. the view where the listbox is. So you have to map the selectedStep attribute from the top view to the component controller. Then create a usage dependency from Second View to the Component Controller.
Now when you select something from the list, your action handler fires, insde the action handler method access the component controller to set the value of the selected step. i.e. do something like below:
if(listValue.equals("Student"))
wdThis.wdGet<Your Component Controller Name>.setSelectedStep("Tab0");
So the data will be first set in the Component Controller Attribute, and as its mapped to the First View Context attribute, so the same value will be populated in the First View too. So the TabStrip will show the appropriate Tab.
Regards,
Shubhadip
P.S: Please reward points to the APPROPRIATE person if your problem gets solved.
Hi Mohammad,
You have to map the Select attribute with the selectedTab property of the tabstrip. For that click on the three dots besides the down arrow key in the property selectedTab and then select the Select attribute from the context.
Then it will work.
Regards,
Jaydeep
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
91 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.