cancel
Showing results for 
Search instead for 
Did you mean: 

link to action in table view

Former Member
0 Kudos

Hello,

I am using the cell editor link_to_action in an table view. When clicking this link I would like to get the value of this specific column. I get the value of the row with:

context_element->get_static_attributes( ) and the ID of the column but not the value for example "21.05.".

thanks and regards

stefan

Accepted Solutions (0)

Answers (3)

Answers (3)

Yashpal
Active Contributor
0 Kudos

Hi,

As the link text displayed is attached to the text property of the link and u can only get or set the property only when u r in wddomodifyview . there is no way to get the this text in other method .u have to go with the context_element and get the desired attribute by hardcoding.. the attribute name ..

Regards

Yash

Former Member
0 Kudos

Hi Yash,

my problem is that I dont know the attribute_name. I have a row with diiferent columns:

month day1 day2 day3 day4 day5

Now the user clicks on maybe day3. I get the whole context_element and the ID.

So when the ID is "table_day1_editor" I have to get the day1 from the middle of the ID and use it at the attributename?

regards

stefan

Former Member
0 Kudos

Hi,

you should take the id,

use a reference of your view (which you add to the attributes in wddomodifyview)

and do

lo_inputfield = wd_this->m_view->get_element( ID ).

lv_value = lo_inputfield->get_value( ).

grtz,

Koen

Former Member
0 Kudos

Hi,

You can use below mentioned code in the event handler of your action.

DATA lo_nd_node TYPE REF TO if_wd_context_node.

DATA lo_el_node TYPE REF TO if_wd_context_element.

DATA ls_node TYPE wd_this->element_node.

DATA lead_selection_index TYPE i.

  • navigate from <CONTEXT> to <NODE> via lead selection

lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).

IF ( lo_nd_node IS INITIAL ).

ENDIF.

<b>lo_el_node = wdevent->get_context_element('CONTEXT_ELEMENT').

lo_el_node->get_static_attributes( IMPORTING static_attributes = ls_node ).</b>

Now you will get the values of all the column fields of clicked row in <b>ls_node</b> structure.

Now you can take the value of the clicked column from ls_node.

Regards,

Aditya Baheti

Former Member
0 Kudos

Hi Aditya,

my problem is that all columns hold a different date and I do not which column was clicked. I solved it by using the ID which I do not really like.

regards

stefan

Former Member
0 Kudos

Hi,

If you get the static attributes, it's only a matter of knowing the attribute name,

which represents the value 21,05 and do:

context_element->get_static_attributes( importing static_attributes = ls_structure ).

lv_value = ls_structure-attributename.

if the table is full of links,

do

context_element->get_attributes( exporting name = ID

importing value = lv_value

).

grtz,

Koen

Former Member
0 Kudos

hi stefan ,

Just try reading coloumn ( field / attribute ) you want .As by default lead selected rows coloumn value will come .

Take case I have simple table to name and no .And it have currently some four entries in it.To know currently clicked entry in table (i.ie Name and no. ) I will do as following

DATA lo_nd_nd_table TYPE REF TO if_wd_context_node.

DATA lo_el_nd_table TYPE REF TO if_wd_context_element.

DATA ls_nd_table TYPE wd_this->element_nd_table.

DATA : lv_name LIKE ls_nd_table-name,

lv_no LIKE ls_nd_table-no.

  • navigate from <CONTEXT> to <ND_TABLE> via lead selection

lo_nd_nd_table = wd_context->get_child_node( name = wd_this->wdctx_nd_table ).

  • @TODO handle not set lead selection

IF lo_nd_nd_table IS INITIAL.

ENDIF.

  • get element via lead selection

lo_el_nd_table = lo_nd_nd_table->get_element( ).

  • @TODO handle not set lead selection

IF lo_el_nd_table IS INITIAL.

ENDIF.

  • alternative access via index

  • lo_el_nd_table = lo_nd_nd_table->get_element( index = 1 ).

  • @TODO handle non existant child

  • IF lo_el_nd_table IS INITIAL.

  • ENDIF.

  • get single attribute

lo_el_nd_table->get_attribute(

EXPORTING

name = `NAME`

IMPORTING

value = lv_name ).

lo_el_nd_table->get_attribute(

EXPORTING

name = `No`

IMPORTING

value = lv_no ).

Please let know if u want something different .