on 09-26-2010 3:24 PM
Hi Guys,
i have a requirement where i have a drop down by key which displays 2 elements A ,B
initially no content related to A and B must be visible
when users selects A from drop down , All the content regarding A must be displayed and
when user selects B from drop down ,All the content regarding must must be displayed
please suggest me how to proceed
plz help me in writing code for calling 'A" from drop down by key
and "B" .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Assume u have 20 fields together and u need to display 10 of them for A and 10 for B:
1. Create a Transparent container in the View under the Root Container
2. Add the 10 UI elements in the container
3. Create another transparent container and add the remaining 10 elements in this.
4. Navigate to Dictionaries>Local Dictionary>Simple Types
5. Right-Click>Create new Simple Type>Enter the name and package. Click on finish
6. Set the base type as String
7. Switch to "Enumeration" tab and add 2 values
7a. (Key-->A, Value -->A)
7b. (Key-->B, Value -->B)
8. Save the simple type created
9. Switch to the context tab-->create new attribute
10. Enter the name (DDValue) to the attribute and set the type to the simple type created.
11. Create 2 more attributes for controlling visibility of the containers
12. In the context tab>Right click>Create new attribute
13. Enter the name and set the type to "com.sap.ide.webdynpro.uielementdefinitions.Visibility"
14. Bind the Visiblity property of the 2 containers to the 2 attributes created in step 11
15. Create a DD By key and set the SelectedKey property to the attribute created in step 9
16. Create an action for the DD by Key in the OnSelect property
17. Write the following code for the action:
String selectedValue = wdContext().currentContextElement().getDDValue();
if(("A").equalsIgnoreCase(selectedValue))
{
wdContext().currentContextElement().setContainer1Visibility(WDVisibility.VISIBLE);
wdContext().currentContextElement().setContainer2Visibility(WDVisibility.NONE);
}
else if(("B").equalsIgnoreCase(selectedValue))
{
wdContext().currentContextElement().setContainer1Visibility(WDVisibility.NONE);
wdContext().currentContextElement().setContainer2Visibility(WDVisibility.VISIBLE);
}
This should resolve your problem
Regards,
Poojith MV
thanks a lot poojitha u r post has solved my issue
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks all for u r response
but i have nearly 20 labels and 10 input fields and buttons
how to achieve this
please help in writing the code and provide me the best possible way
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
categorize the UI elements which are a part of selection value "A" and put them in a transparent container. similarly, group all the UI elements which needs to be displayed when the selection value is "B" in another transparent container.
Once u do this, bind the "visible" property of the Transparent container to an attribute of type Visibility.
The code which i have given in my previous reply can be used to control the visibility based on selection.
Hope this helps you.
Regards,
Poojith MV
Hi,
use the WDVisibility property to control the visibility of the UI elements. Try the following:
1. In the wdDoInit() method, write the code to populate the Dropdown with the required values (In case the values are loaded at runtime). else create a simple type and load the values for DD at design time.
2. Bind the "visible" property of the UI elements to a context attribute of type Visibility.
3. In the wdDoInit() method, write the following code to hide the UI elements:
wdContext().currentContextElement().setAFieldVisibility(WDVisibility.NONE);
wdContext().currentContextElement().setBFieldVisibility(WDVisibility.NONE);
4. Create an action for the DD and write the following code:
if(("A").equalsIgnoreCase(wdContext().currentContextElement().getDDSelection)
{
---wdContext().currentContextElement().setAFieldVisibility(WDVisibility.VISIBLE);
---wdContext().currentContextElement().setBFieldVisibility(WDVisibility.NONE);
}
else if(("B").equalsIgnoreCase(wdContext().currentContextElement().getDDSelection)
{
---wdContext().currentContextElement().setBFieldVisibility(WDVisibility.VISIBLE);
---wdContext().currentContextElement().setAFieldVisibility(WDVisibility.NONE);
}
Regards,
Poojith MV
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Vimal
To populate the dropdown by key, use the below codes : -
HashMap keyValueList = new HashMap();
keyValueList.put("A", "AList");
keyValueList.put("B", "BList");
IWDAttributeInfo nodeInfo = wdContext.node<NODE NAME like XYZ>().getNodeInfo().getAttribute("Node Context Attribute Name ABC");
ISimpleTypeModifiable simpleType = nodeInfo.getModifiableSimpleType();
IModifiableSimpleValueSet valueSet = simpleType.getSVServices().getModifiableSimpleValueSet();
valueSet.clear();
Iterator iterator = keyValueList.keySet().iterator();
while(iterator.hasNext()) {
Object keyValue = iterator.next();
valueSet.put(keyValue, keyValueList.get(keyValue).toString());
}
Then create the method can call from onSelect even of the Dropdown by key. In the method put the logic to populate the content related to A and B based on the selected input A or B from dropdown.
wdContext.currentXYZ().getABC() ...it will returns values A or B.
Hope it will helps
Regards
Arun Jaiswal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can do it in the onSelect action of the drop down. Create attribute of "com.sap.ide.webdynpro.uielementdefinitions.Visibility" and map it to the visible property of the UI elements which you want to display on the selection. Check with the key value of the simpleType for the dropdown and make UI elements visible and invisible.
Hope it helps.
Regards,
Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
you can write code in the event handler of the drop down.
create two attribute with type visibility in the controller.
bind them to the content which you want to control the visibility.
in the event handler, set the attribute to visible or none according to your requirement.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.