cancel
Showing results for 
Search instead for 
Did you mean: 

How to dynamically insert UI to View

Former Member
0 Kudos

i need dynamically create link,

like HTML Tag <a href='URL' >text</a>

public void wdDoInit()

{

ArrayList al = .... (URL String List)

for(int i =0;i<al.size(); i++)

{

..... HOW TO CODING??

}

}

Dynamically Insert UI to View or Dynamically Insert UI to View LinkToURL

Accepted Solutions (1)

Accepted Solutions (1)

gill367
Active Contributor
0 Kudos

hi

Use the following code to in wddomodify method


if(firstTime)
    {
    	IWDTransparentContainer tc = (IWDTransparentContainer)view.getElement("RootUIElementContainer");
    	
    IWDLinkToURL ld = (IWDLinkToURL)view.createElement(IWDLinkToURL.class,"ltu" );
    ld.setTarget("http://www.google.com");
    ld.setText("test...");
    ld.setEnabled(true);
    	
    	tc.addChild(ld);
	
    }

thnaks

Sarbjeet

Former Member
0 Kudos

hi Sarbjeet

this is my code,

how coding LinkToURL UI put in Group UI and how use group.createLayout() method for GridLayout ?


	if(firstTime)
	{
		IWDTransparentContainer tc = (IWDTransparentContainer)view.getElement("RootUIElementContainer");
		tc = (IWDTransparentContainer)view.getElement("RootUIElementContainer");
		
		IWDCaption groupTitle = (IWDCaption)view.createElement(IWDCaption.class,"GroupTitle");
		groupTitle.setText("TempGroup");
		
		IWDGroup group = (IWDGroup)view.createElement(IWDGroup.class,"DynamicallyGroup");
		group.setHeader(groupTitle);
		group.setWidth("100%");
		group.setEnabled(true);
		tc.addChild(group);
		
		for (int i=0 ; i<10; i++)
		{
			tc = (IWDTransparentContainer)view.getElement("RootUIElementContainer");
			IWDLinkToURL ld = (IWDLinkToURL)view.createElement(IWDLinkToURL.class,"ltu"+i );
			ld.setTarget("http://www.google.com");
			ld.setReference("http://www.google.com");
			ld.setText("test..."+i+"\t");
			ld.setEnabled(true);
			tc.addChild(ld);
		}
	}

Former Member
0 Kudos

Hi,

Use the below code.



IWDGridLayout layout = (IWDGridLayout) group.createLayout(IWDGridLayout.class);
group.set...

You can set its various properties through its setter methods.

You can always search SDN and you will definetly get the solution for these commonly asked questions without waiting for the response here : )

Hope it helps.

Regards,

Manoj

Former Member
0 Kudos

Thank Manoj

i can search SDN , but i do not know how to search for keywords : )

ex..

now i add TextView or LinkToURL .... to Group Child?

keywords is ><"

gill367
Active Contributor
0 Kudos
IWDGridLayout layout = (IWDGridLayout) group.createLayout(IWDGridLayout.class);

yeah this is correct

you can search for "dynamically adding UI element" then you will get lots of examples

Thanks

sarbjeet Singh

Answers (2)

Answers (2)

ErvinSzolke
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

see also the video which covers dynamic UI generation as well:

http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/media/uuid/3178ae74-0701-0010-ba8d-e3ca9f1edc1...

Best Regards,

Ervin

Former Member
0 Kudos

you gotta create the uI elements in the method wdDoModify()

for each entry you need to create a new UI element of type LinkToUrl

or are you looking for the exact code?

Former Member
0 Kudos

you can for me one a sample code?