cancel
Showing results for 
Search instead for 
Did you mean: 

Which row's onEnter of a table

Former Member
0 Kudos

Hi,

There is a table that has a column of non-readonly inputfield, which onEnter() is bound to an action handler.

When user presses "Enter" in one of the inputfield, how to know which row emits the onEnter event?

Thanks!

Tony

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Shyam & Satyajit,

Your suggestions work when user choose the inputfield by mouse before pressing enter.

However, the user can also use the keyboard arrow to move the blinking cursor upward and downward in the column of inputfield. If the blinking cursor is not at the same row as the lead-selected row, and user press enter at this moment, the lead selection will be kept unchanged.

Another failure scenario is when the table has master column, i.e. TreeByNestingTable and the tableUI's selectionMode is set to be "none". No leadselect event will be generated. Moreover, the lead selection of the bound data node is not changed.

Thus, your suggested way is possible but not a perfect one.

Regards,

Tony

Former Member
0 Kudos

Hi

In the eventhandler of onEnter try the below code:

int index = wdContext.current<node name>Element().index();

Since the index starts from 0, the value returned will one less than the exact row number.

Hope this helps.

Regards,

Rathna.

Former Member
0 Kudos

Map the implicit event parameter "nodeElement" to an action handler parameter "element" of type IWDNodeElement.

inputField.mappingOfOnAction().addSourceMapping
(
  "nodeElement",
  "element" /* name of action parameter */
);

Then you can get the row by element.index() inside the action handler.

Armin

Former Member
0 Kudos

Dear Armin,

I tried it with TreeByNestingTableColumn and it works!

Thanks your help!

Tony Kwan

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

In the eventhandler try this:

int rowIndex = wdContext.node<NodeName>.getLeadSelection();

This will give you the zero based index of the row on which the Enter has been pressed.

Regards,

Satyajit.

Former Member
0 Kudos

Hi Tony,

In the implementation for OnEnter, you can get the current lead selected element of the node which you had bound to the table.Thus for that particular row, the action will be executed.

regards

Shyam.