on 01-30-2008 4:45 AM
Hi ,
In my application I need to generate Dynamic TextView. I am having node Details and its attribute Name of type String.
Node > Details (Cardinality 0-n)
-
Name (type String Value Attribute)
I want to generate textview dynamically for number of time as size of Node Details. I have written following code to generate TextView , but i am not getting how to bind Name attribute to Dynamically genarated TextView. Can any one plz help me writing code for binding???
Thnx in advance.
Kavita
IWDTransparentContainer container =(IWDTransparentContainer)view.getElement("RootUIElementContainer");
for(int i=0;i<wdcontext.nodeDetails().size();i++)
{
IWDInputField inputfield = (IWDInputField)view.createElement(IWDInputField.class, "InputField"+i);
// Binding ??????
container.addChild(inputfield);
}
Do you want to get TextViews or InputFields? Anyway, you cannot bind either against individual node elements. To achieve what you want you have to use a Table or RowRepeater and bind the embedded editor to the "Name" attribute, or you have to create separate context attributes Name1, ..., NameN and bind individual UI elements against these attributes.
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 Reichert
Actually i am developing quiz application , where i need to show question text and number of options(RadioButtons). What i have posted in this thread is similar to my actual quiz application. The number of question is going to be decided at run time so i want to use dynamic UI generation. As you said i can use table and bind nodes to table , but how can i insert number of radio buttons for option in one single row of table for each question????
Kavita
Hi,
here is a sample tutorial which discuss about a quiz app
may be of use for you.
Regards
Ayyapparaj
Hi Kavita,
Check out this link for dynamic UI element creation[Link|https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sapportals.km.docs/business_packages/a1-8-4/17tutwd_dynamic.zip]
Regards, Suresh KB
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kavitha,
//Iterate to get the attributes
Iterator itr1 = wdContext.nodeDetails().getNodeInfo().iterateAttributes();
IWDTransparentContainer container = (IWDTransparentContainer)view.getElement("<Your Root Container>");
while(itr1.hasNext())
{
// Input Field for each attribute
IWDInputField input= (IWDInputField)view.createElement(IWDInputField.class,null);
IWDAttributeInfo iWDInfo = (IWDAttributeInfo) itr1.next();
input.bindValue("Details."+iWDInfo.getName());
//Add to the container
container.addChild(input);
}
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Modifying your code:
IWDTransparentContainer container =(IWDTransparentContainer)view.getElement"RootUIElementContainer");
for(int i=0;i<wdcontext.nodeDetails().size();i++)
{
IWDInputField inputfield = (IWDInputField)view.createElement(IWDInputField.class, "InputField"+i);
// Binding
inputfield.bindValue("Details.Name");
container.addChild(inputfield);
}
Regards,
Satyajit.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Plz check following code
IWDNodeInfo soNi = wdContext.getChildNode("SalesOrders",0).
getNodeInfo();
for(Iterator it = soNi.iterateAttributes(); it.hasNext();)
{
IWDAttributeInfo thisAttr = (IWDAttributeInfo)it.next();
IWDInputField inFld = (IWDInputField)view.createElement(
IWDInputField.class,thisAttr.getName() + "Input");
// Bind the input field to the relevant context attribute
inFld.bindValue(thisAttr);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
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.