cancel
Showing results for 
Search instead for 
Did you mean: 

how to handle UI elements property

former_member205624
Contributor
0 Kudos

hi, all

this is very common problum which every one face. The problum is that how one can handle UI elements(Radio,Label,Input field ) property dynamically.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Bind the properties to context attributes and set the attribute values.

Armin

Former Member
0 Kudos

Hi jitender,

i think ur problem is to change the properties of UI elements dynamically, if this is the case...

create the context value attribute of type which ever u want to set for the property... for example if u want to set enable property, u have to create a boolean value attribute...

then bind that value attribute to corresponding UI property...

then u can access that in the code as

wdContext.currentContextElement().set<name of the value Attribute("<ur value>");

hope this helps u

regards

sunil

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Jitendra,

Create a node with attributes which will be bound to the property elements of your UI element, also take care of the type of attribute while creating it. At some places you will need "boolean" and at some you will need "string".

Now for the sale of eg. consider you want to disable a input field named "ABC" on click of a button say "click". Follow the steps to achieve same:

1) Create a node, not necessarily though.

2) create a attribute ABC_ENABLE of type boolean, depending on your requirement you can assign it default property of X,for enable, or '', for disable.

3) bind it to Enable property of CLICK button

4) now use method set_attribute () inside action handler OnActionClick() to set the property to true or false and the behaviour will be reflected there at the UI element.

Hope this helps.

Regards,

Anoop

Former Member
0 Kudos

Hi Jitender

The properties of these UI elements is handled in WDModifyView Method.

example: Accessing the Input Fields

the code looks like this.

IWDInputField input =(IWDInputField)view.getElement("<name of id>");

input.setEnabled(true);

// and other values..

I hope this helps you

Thanks

Srikant

Former Member
0 Kudos

hai,

create UIElements dynamicaly is possible in wdModify method only.

like this

public static void wdDoModifyView(IPrivateDynamicAppView wdThis, IPrivateDynamicAppView.IContextNode wdContext, com.sap.tc.webdynpro.progmodel.api.IWDView view, boolean firstTime)

{

//@@begin wdDoModifyView

if(wdContext.currentContextElement().getBoolfor()){

IWDTransparentContainer tcont1 = (IWDTransparentContainer)view.getElement("TransparentContainer1");

IWDGridLayout k=(IWDGridLayout)tcont1.getLayout();

k.setColCount(1);

IWDLabel lo=(IWDLabel)view.createElement

lo.setDesign(WDLabelDesign.LIGHT);

wdContext.currentContextElement().setBoolfor(false);

//@@end

}

here boolfor is the context attribute of type boolean. you can set it true in whch action do u want to invoke the cod in wdmodifyview.

all the best.

regards,

naga raju

Yashpal
Active Contributor
0 Kudos

Hi Jitender,

In WDModifyView() u can handle the properties of the view elements ........

get the reference of the UI elements and then u can manipulate the propeties of that....see the below link

Link to document....

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/uuid/74cda090-0201...

Regards,

yash