Skip to Content
author's profile photo Former Member
Former Member

Dynamic UI Binding Problem

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);

}

Add a comment
10|10000 characters needed characters exceeded

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 05:57 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 04:55 AM

    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);

    }

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 04:59 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      That's normal for stand-alone Inputfields. If you want different values for the different inputfields based on the same node attribute then put the Inputfields in a table, or bind them to different attributes.

      Regards,

      Satyajit.

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 05:00 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Ayyapparaj ,

      The code which you gave me is iterating number of attributes under Node Details , so only one textView is getting generated dynamically not as size of Details Node

      Ragards

      Kavita

  • author's profile photo Former Member
    Former Member
    Posted on Jan 30, 2008 at 05:03 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.