cancel
Showing results for 
Search instead for 
Did you mean: 

Second cklick on row of the table

Former Member
0 Kudos

Hi experts,

I created Web Dynpro with table. And now when I click on row second time, then row will be still selested. But I need row not to be selected after second click.

Is it enable make it via properties of the table? or coding?

Thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Evgeny,

You can acieve this by doing some coding. follow this...

1. Create 2 attributes in component controller: ACTION_NAME type string and LV_INDEX of type integer ( I ) and

check PUBLIC check box. Make both attributes as public.

2. Go to view WDDOBEFOREACTION method, paste below code.

data lo_api_controller type ref to if_wd_view_controller.

data lo_action type ref to if_wd_action.

lo_api_controller = wd_this->wd_get_api( ).

lo_action = lo_api_controller->get_current_action( ).

if lo_action is bound.

wd_comp_controller->action_name = lo_action->name.

endif.

3. Create one action say 'ONSELE' and attach it with the event OnLeadSelect event of the table. No code is required

in this event handler.

4. GO to WDDOMODIFYVIEW method, use below code.

*Assume this is the node which holds the table data

DATA lo_nd_flight TYPE REF TO if_wd_context_node.

DATA lo_el_flight TYPE REF TO if_wd_context_element.

DATA ls_flight TYPE wd_this->element_segment1.

DATA lv_index TYPE i.

IF wd_comp_controller->action_name = 'ONSELE'.

lo_nd_flight = wd_context->get_child_node( name = wd_this->wdctx_SEGMENT1 ).

*Get the currently selected row ( if any )

CALL METHOD lo_nd_flight->get_lead_selection_index

RECEIVING

index = lv_index.

*This condition is to ensure that if the same row is clicked again, it is unselected

IF wd_comp_controller->lv_index EQ lv_index AND

wd_comp_controller->lv_index IS NOT INITIAL.

*Below methods call will make sure that lead selection is removed

CALL METHOD lo_nd_flight->clear_selection.

lo_nd_flight->set_lead_selection_index( '-1' ).

CLEAR wd_comp_controller->lv_index.

ELSE.

wd_comp_controller->lv_index = lv_index.

ENDIF.

ENDIF.

Now run your application and check by select/deselecting row of a table. It will work.

Cheers,

Kris.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

I think this is not possible with table property. There is no property like on/off of lead selection.

However programmatic you can handle this on the event handler of the lead_selection.

If the row is already selected then set the lead_selection_index to -2.