cancel
Showing results for 
Search instead for 
Did you mean: 

how to use lead selection

Former Member
0 Kudos

hi,

i am new to web dynpro. what is lead selection for node? how can i use it? i want to populate diff rows of data in the table, and i think i have to use LeadSelection for that but can anyone explain me how can i make use of that?

thanx...

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

hi

Exactly one element of the node collection is highlighted as the lead selection. The lead selection of a context node points to either a single selected node element (value of the lead selection = number of the selected node element) or it has the value of constants IWDNode.NO_SELECTION, if no node element is selected.

For example for a table node

if you want to specify a certain row to be selected at run time

or get a value

For example if you have 3 columns for your table and want to gat

a value of column1 thatyou have selected .then you can use following code

for(int i=0;i<wdcontext.node<Your Table Node>.size<1;i++)

{

String s = wdContext.node<your Table>.get<Your Table TableElementAt(i)>.getColumn1()

}

Now you can get the value of column1 that you have selected .

Regards

Madhavi

Former Member
0 Kudos

Hi,

this link helful to know about the Lead Selection and Node Selection

http://help.sap.com/saphelp_nw70/helpdata/EN/f1/94384162316532e10000000a1550b0/content.htm

and the leadselection is used to point or select a particular row in the table.

Regards,

ramesh

Former Member
0 Kudos

Hi,


//	g et index of selected table row 
		int i = wdContext.nodeTableContent().getLeadSelection();
		//	get the name of the according object (resource)
		String name =
			wdContext
				.nodeTableContent()
				.getTableContentElementAt(i)
				.getObjectName();

Regards

Khushboo

Former Member
0 Kudos

Hi,

You have rows in the table and each row is called element (of the data source node) in the table. The lead select will return you the postion of the selected row in the table at any point of time. It is based on index 1.

thanks & regards,

Manoj

Former Member
0 Kudos

thanx but how can i use it in my coding?

Former Member
0 Kudos

Hi,

on lead selection you can do many operations like delet particular row .As per your requirment u want to populated the data in table row selected.

so create one method n bind it to the table OnLeadselect event,n writ the code to populate the data.



public void onActionAdd(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
  {
    //@@begin onActionAdd(ServerEvent)
    
   
    int n = wdContext.nodeTable().size();
		int leadSelected = wdContext.nodeTable().getLeadSelection();
		// loop backwards to avoid index troubles
		for (int i = n - 1; i >= 0; --i) {
		  if (wdContext.nodeTable().isMultiSelected(i) || leadSelected == i)     
    
	IPrivateAssi3View.ITable_1Element tabadd = wdContext.createTable_1Element();
 
		tabadd.setDept_ID(wdContext.currentTable_1Element().getDept_ID());
	    tabadd.setName(wdContext.currentTable_1Element().getName());
	     tabadd.setPSNO(wdContext.currentTable_1Element().getPSNO());
		wdContext.nodeTable_1().addElement(tabadd);
	  //wdContext.nodeTable_1().setLeadSelection(wdContext.nodeTable_1().size()+1);
		//wdContext.nodeTable_1().moveNext();
    }
    //@@end
  }