cancel
Showing results for 
Search instead for 
Did you mean: 

Get Table Cell row and column index 'On Click' of a cell by a user in the generated table

Former Member
0 Kudos

Hi Experts,

I need some help in getting a Table Cell reference ie: row and column index 'On Click' of a cell by a user in the generated table.

The UI Table and it's context is generated dynamically and I need a populate a value in the table cell which a user clicks on.

I need to fill in a value in only 1 table cell which user clicks in the generated table. User selects a cell and then clicks a button in header, from this button event I am trying fill a value 'A' in the cell user clicked.

Please suggest as I new to WD area dealing with dynamic table context and UI generation.

Thanks in advance.

Regards,

Gaurav

Accepted Solutions (1)

Accepted Solutions (1)

former_member184578
Active Contributor
0 Kudos

Hi,

There is no provision for getting the cell id as there are no Focus events/ reading cursor positions. You need to create an onEnter event for your Input field of Table Cell Editor and have to press 'Enter', then onEnter you can get the cell ID.

Regards,

Kiran    

Former Member
0 Kudos

Thanks a lot Kiran for throwing some light on the customization which I am trying on.

I went through a number of sdn posts, referring Link to Action at places, but tried the same to handle the scenario, but it didn't work.

Actually in current scenario, the field is not editable nor it is supposed to be an input field, user sees a cell in table and if he needs to calculate value for that cell, then he can click cell and system should fill cell with value.

Former Member
0 Kudos

Hi Kiran,

Can you please help me know how can i call and get cell id inside On_Enter event linked to Table Cell as input field ? I have set the table cell as input field not still not able to see how to get cell id/ref inside on_enter event.

Thanks in advance.

former_member184578
Active Contributor
0 Kudos

Hi,

You can get the row index of the cell on which the enter is pressed using the below code;


   DATA lr_el_element TYPE REF TO if_wd_context_element.

   DATA lv_index TYPE i.

   lr_el_element = wdevent->get_context_element( 'CONTEXT_ELEMENT' ).

    lv_index = lr_el_element->get_index( ).

As, you will have the column already ( to which the onEnter is created), loop the table entries and when the sy-tabix EQ to lv_index set the value to the corresponding column.

hope this helps,

Regards,

Kiran

Former Member
0 Kudos

Thanks Kiran for your prompt help, but I was majorly trying to see, if some way i can have onClick event created/handled in, as for the requirement onEnter is not acceptable .

Row index I am already getting on lead selection, but only thing troubling was column number/ID for which I raised this SDN post. Row I am getting everywhere bcz of lead selection in table.

former_member184578
Active Contributor
0 Kudos

Hi,

As mentioned already, there is no such provision. One way is to use LinkToAction UI as cell editor and onClick of the link, you can make the Link disable and set the value to that.

Row index I am already getting on lead selection, but only thing troubling was column number/ID for which I raised this SDN post

Column ID is static, isn't  it?

Let's say, you have the Table like below,

ID    COL1   COL2

1      _ _ _      XYZ

2      _ _ _       SDF

And you make COL1 as Input field and created onEnter for that. Now the when you press Enter in any row of COL1, the ID of COL1 is same, isn;t it?

What I mentioned earlier was, In onEnter get the Row index and loop the table entries and for the corresponding row set the value to the column (COL1). Is my understanding diiffers from the issue you are facing?

Regards,

Kiran

Answers (0)