cancel
Showing results for 
Search instead for 
Did you mean: 

Selection of row in a table

Former Member
0 Kudos

Hello all,

I have attached to my InputField in a table a method onEnter and when I push <enter> in a editabele cell of a row unfortunatly system returns me not a number of row that I made an <enter> (I have editable table) but the row that is selected (in orange) while user is in another cell...

I tried to use getLeadSelection or index but it returns me the row selected in a table not a number of row in which I push <enter>

Thank you in advance for any help

Bogumila

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

we generally map a structure to the table, have an attribute 'key' (or 'count') which hold the key value in it.

when we click on the lead selection the current table row will be returned from which you can fetch the key attriute value and use it for further processing.

Regards,

S.Divakar

Former Member
0 Kudos

I know that I do that but system does not recognize the numer of row if you are not in row which is selected (orange frame) if you are in a diffrent row and push <enter> systems returns me the orange frame-selected row index instead of current row where user write the data....

but anyway thank you I will try to find a solution...Bogusia

Former Member
0 Kudos

You want to get the node element (table row) in which the onEnter event of the input field (cell editor) "Editor" has been triggered:

Add a parameter "row" of type IWDNodeElement to the action "Action" assigned to the onEnter event.

Define a parameter mapping in wdDoModifyView():

if (firstTime)
{
  IWDInputField editor = (IWDInputField) view.getElement("Editor");
  editor.mappingOfOnAction().addSourceMapping
  (
    "nodeElement", /* name of (implicit) event parameter */
    "row" /* name of your action parameter */
  );
}

Then after pressing ENTER in the editor of row number i, the action handler parameter "row" will contain the node element corresponding to this row.

If you are only interested in the row index (which I doubt), you get it as row.index().

Armin

Former Member
0 Kudos

Thank you for your solution

I have used it :

In procedure for my View I have added a code:

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

{

//@@begin wdDoModifyView

IWDInputField editor = (IWDInputField) view.getElement("Cell_name_where_I_want_to_catch_onEnter");

editor.mappingOfOnEnter().addSourceMapping

(

"nodeElement", /* name of (implicit) event parameter */

"row" /* name of your action parameter */

);

At onEnter event for my cell "Cell_name_where_I_want_to_catch_onEnter" I have attached a method CountMax with a parameter with a type

"row" of type IWDNodeElement

I have implemented it as following to have an access to the row where OnEnter was triggered.

public void onCountMax (com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.tc.webdynpro.progmodel.api.IWDNodeElement row )

{

//@@begin

IWDNodeElement tableElement;

tableElement = row.node().getElementAt(row.index);

//@@end

}

/*

Former Member
0 Kudos

What is this code

IWDNodeElement tableElement;
tableElement = row.node().getElementAt(row.index());

good for?

Armin

Former Member
0 Kudos

What is the thread's topic "Selection of row in a table"

This is the row that has been selected with onEnter!

IWDNodeElement tableElement;

tableElement = row.node().getElementAt(row.index());

Greetings Bogusia

Former Member
0 Kudos

But the parameter "row" already contains the selected row...

Armin

Answers (1)

Answers (1)

Former Member
0 Kudos

hi

Declare a global variable say, "count" inside

//@@begin others

int count=0;

//@@end

Give the increment of the variable "count" in the onenter method.

public void onActioncount(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )

{

//@@begin onActioncount(ServerEvent)

count++;

//@@end

}

Hope this works. If this is not the answer u want explain ur scenario a bit more.

Regards,

saravana.

Former Member
0 Kudos

Hello Saravana I think that it is not what I wanted...

One more time"

I have an editable UI table element on a screen with

e.g. 10 columns, as you know it's possible to make a selection on the rows (than a row is marked in orange frame) when my user enters the data in this table he is not making a selection on the individual row - selection is a separate thing, situation:

e.g. selected row (orange frame) is at 2nd row, but user

is in 5th row writing something in a cell, than he pushes <enter> within this row - when I use then LeadSelection or index , system returns 2 instead of 5... (because the selected(orange frame) row is 2 but user is in 5th row writing something in cell)

I cannot tell user to fill the table selecting each time the row because it lasts... to long for!!!

and he has in real 200 rows to fill....

I need it for a column where there are diffrents text and they must have diffrent lenght I know that it is not possible to insert in a table column diffrent lenght text element at each row(the lenght is stored in the other column) I want to tell user using a message that he has written too many characters but I must first read at which row he is (because in the other colum max.lenghs is stored and I must read it to display a message in this case)

I hope this is clear now...Thank You BOGUSIA