cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamically Change Button Text in a Table

Former Member
0 Kudos

Hello,

I'm looking for a way to dynamically change a button text inside a table, based on certain conditions. In the WDDOMODIFYVIEW method of my View, I figured out how to change the button text using the code below, however, this changes the button text for all my records returned. I'd like to be able to control the text for each record in my table, before the page renders.

Here's the code I have thus far:


        lr_table_column type ref to CL_WD_TABLE_COLUMN,
        lr_button       type ref to CL_WD_BUTTON.

        lr_table_column ?= view->get_element( 'TABLE_BUTTON' ).

        lr_button  ?= lr_table_column->get_table_cell_editor( ).

        lr_button->SET_TEXT( 'test' ).

Is there a way to accomplish in WD4A?

Thanks,

Matt

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi, Matthew,

What if you assign a node atribute to thet text property of your button?

Regards,

Andre

Former Member
0 Kudos

Andre,

Thanks for the response! Assigning a node attribute to the text property of button worked perfectly! I awarded you 10 points

Thanks,

Matt

Answers (1)

Answers (1)

Former Member
0 Kudos

Hellow,

data lo_btn_function type ref to cl_salv_wd_function.

data: lv_button1_text type string.

lv_button1_text = 'Button Text'.

lo_btn_function = lo_config_model_value->if_salv_wd_function_settings~create_function( 'BUTTON' ).

lo_btn_function->set_editor( lo_button ).

create object lo_button.

call method lo_button->set_text

exporting

value = lv_button1_text.

Try this way, it should work.

Regards,

Naresh.