cancel
Showing results for 
Search instead for 
Did you mean: 

Deselect the row in a table

former_member226239
Contributor
0 Kudos

Hi All,

How to deselect the row in a table?

I am using the following code to display a table and "select" a row.


        <thtmlb:cellerator design                = "STANDARD"
                           id                    = "casetable"
                           onHeaderClick         = "HeaderClick"
                           onRowSelection        = "RowSelection"
                           selectionMode         = "SINGLE"
                           selectedRowIndex      = "<%= controller->gv_selected_row %>"
                           selectedRowIndexTable = "<%= controller->gt_selected_rows %>"
                           iterator              = "<%= controller->gr_me %>"
                           table                 = "<%= ZL_ZADJ_SEARCH_IMPL=>GT_CASE %>"
                           fillUpEmptyRows       = "FALSE"
                           horizontalScrolling   = "TRUE"
                           rowSelectionByLineClick = "TRUE"
                           verticalScrolling     = "TRUE"
                           visibleFirstRow       = "1"
                           visibleRowCount       = "100"
                           width                 = "100%"
                           personalizable        = "TRUE"
                           showPersonalizeButton = "FALSE"
                           usage                 = "EDITLIST"
                           columnDefinitions     = "<%= it_tabcols %>" >

Thanks,

Chandra Indukuri

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member206299
Contributor
0 Kudos

Hi Chandra,

As per the HTML code it should have got deselected by standard feature.

The Event Handler EH_ON_ROW_SELECTION decides which row to be selected and deselected.

Have debugger in this Event handler as this gives clue why the standard code is failing.

Regards,

Sijo

former_member226239
Contributor
0 Kudos

Thank you Snehasish and Bhushan.

Sijo,

you are right. The standard feature should have done select/deselect automatically.

But it is not..... In the event handler method I just have


* Get the index of the selected row
  lv_thtmlb_tableview ?= htmlb_event_ex.
  if lv_thtmlb_tableview is bound.
    gv_selected_row = lv_thtmlb_tableview->selectedrowindex.
  endif.

Interesting thing is that the deselect functionality is working in one component and is not working in another. Don't know what I am missing.

Former Member
0 Kudos

Hi,

Please ensure that the famework clas method eh_on_row_selection is being called in your context node class eh_on-row_sleection.

Ie when you open the context ndoe class method EH_ON_ROW_SELECTION,you should be able to see this code.

CALL METHOD super->eh_on_row_selection

EXPORTING

iv_htmlb_event = iv_htmlb_event

iv_htmlb_event_ex = iv_htmlb_event_ex.

me->selection_mode = selmode_single.

If not,please add the supe class method call and also the setting of the selection mode.

Suvidha

Former Member
0 Kudos

Hi,

You have an attribute 'onRowSelection' the value that you give for this attribute is name of event that is raised after you select the row.

Create an event handler method having same name as that of value in attribute.

For a code to deselect, please have a look at method EH_ON_ROW_SELECTION in class CL_BSP_WD_CONTEXT_NODE_TV.

read table ME->SELECTION_TAB with key TABLE_LINE = LV_ROW_INDEX

binary search transporting no fields.

if SY-SUBRC = 0.

  • line was marked -> unmark it

if ME->FILTER_ACTIVE = ABAP_TRUE.

ME->LAST_LINE_ITERATOR->UNMARK( IV_INDEX = LV_ROW_INDEX ).

else.

ME->COLLECTION_WRAPPER->UNMARK( IV_INDEX = LV_ROW_INDEX ).

clear ME->SELECTED_INDEX.

endif.

else.

  • line was not yet marked -> mark it

if ME->FILTER_ACTIVE = ABAP_TRUE.

ME->LAST_LINE_ITERATOR->MARK( IV_INDEX = LV_ROW_INDEX ).

else.

ME->COLLECTION_WRAPPER->MARK( IV_INDEX = LV_ROW_INDEX ).

ME->SELECTED_INDEX = LV_ROW_INDEX.

endif.

endif.

Hope this helps.

e Regards,

Bhushan

Former Member
0 Kudos

use this code to deselect the rows..

typed_context-><your table context node>->deselect_all( ) .

Regards

Snehasish