cancel
Showing results for 
Search instead for 
Did you mean: 

clearing radio button selection

Former Member
0 Kudos
94

Guys, iam stuck in a situation where iam not able to clear the radio button selection in the SINGLESELECT tableview. I am using MVC approach and my layout is similar to bookshop example in SAP tutorial_4_mvc.

I found that even in the SAP example the raio button is not cleared when a new search is used. The radio button remains selected and it has to be clicked again to refresh and retrieve new values. But I would like to clear the selection.

Any help on how to clear previous radio button selection every time the page is reloaded?

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi KP,

May be this mught help you....

to clear selection of tableView, use this code.....in onInputProcessing or DO_HANDLE_EVENT.

cl_htmlb_manager=>check_tableview_all_rows( rowcount = n
request = request
id = '<tableview id>'
keytable = keytable "Table containing the key values of your itab
check = '' ). "If its 'X' all items will be selected and ' ' will uncheck all items.

Hope this helps....

<i><b>Do reward each useful answer....</b></i>

Thanks,

Tatvagna.

Former Member
0 Kudos

i tried this but no luck.

no matter what iam doing the radio buton is preselected with the prevoius selected index.

Is tehre a way to refresh the table event tableview.

i mean

(IF htmlb_event IS BOUND AND

htmlb_event->name = 'tableView'.

table_event ?= htmlb_event.

selectedrowindex = table_event->selectedrowindex.)

can we clear the htmlb_event attributes anyway evrytime i hit submit.

I have a central.do/default.htm page which loads the search.do/search.htm, results.do/results.htm and detail.do/detail.htm(very similar to tuturialmvc4)

In the search.do/search.htm there is a submit button. When it is clicked the results are filled in a tableview with singleselect mode and onrow selection.

The first time the results are shoen with radiobuttons to the left of the results.

Whn I selct the 4th row for example, iget the details of this row in the details.do/details.htm.

Now when I put a new search criteria and hit submit again in the same session, and if the result has 6 rows for example, the 4th row is being preselected.

I have to hit on it once again to see the details.

Please suggest. Is there a flaw in the design? I copied much of the func. form the example tutmvc4 in 6.20.

Thanks.

raja_thangamani
Active Contributor
0 Kudos

KP,

Make your application as<b> stateless</b> & Give a try..If not lets know ..

<i>*Reward each useful answer</i>

Raja T

Answers (2)

Answers (2)

Former Member
0 Kudos

I had to play with selectedrowindex a bit.

Set a flag in DO_HANDLE_EVENT and clear this flag in the predecessor controller if it is checked already.

Thnaks a lot.

raja_thangamani
Active Contributor
0 Kudos

Same issue discussed & resolved in below thread..

<i>*Reward each useful answer</i>

Raja T

Former Member
0 Kudos

hi raja,

i have seen this thread but iam not sure how this would help my sitaution.

i have a tableview like"

<htmlb:tableView id = "result"

headerText = "Header Text"

onNavigate = "onMyNavigate"

selectionMode = "SINGLESELECT"

onRowSelection = "onrowselection"

table = "<%= i_result %>"

iterator = "<%= iterator %>" >

<htmlb:tableViewColumns>

<htmlb:tableViewColumn columnName = "MATNR"

width = "100"

horizontalAlignment = "left"

title = "PART" >

</htmlb:tableViewColumn>

<htmlb:tableViewColumn columnName = "ZFLAG"

width = "100"

horizontalAlignment = "left"

title = "DISCOUNT" >

</htmlb:tableViewColumn>

</htmlb:tableViewColumns>

</htmlb:tableView>

the output has radiobuttons for each of the rows of the i_result.

when i select one of these, the detail appears below.

but when i put a new search above and submit, the new result that shows up has the radio button pre selected. the index of the row selected previously has to be cleared and i am not sure where to do that.

thanks.

Thanks.

raja_thangamani
Active Contributor
0 Kudos

Opps, I misunderstood with your radiobutton word..

When defining the tabelview, utilize the attribute selectedRowIndex and relate it to a <b>page attribute(eg. selectedrowindex type int4 ).</b>

If you use the selectionMode = "SINGLESELECT"

the following would work.

you need to add below things to your layout

<htmlb:tableView id = "result"
....... 
selectionMode = "SINGLESELECT"
.................. 
onRowSelection = "onRowSelection"
...... 
selectedRowIndex = "<%= selectedrowindex %>"
....... 
>

<b>To populate the selectedRowINdex:Use below code in Oninputprocessing:</b>

selectedRowIndex = table_event->SELECTEDROWINDEX

Clear this SelectedRowIndex, in "inputprocessing", whenever you want to deselect the selected row.

<i>*Reward each useful answer</i>

Raja T

Former Member
0 Kudos

hi,

i tried this but for some reason the index of the prviously selected row still gets applied to the new selection and is checked.

in my do_handle_event:

IF htmlb_event IS BOUND AND

htmlb_event->name = 'tableView'.

table_event ?= htmlb_event.

selectedrowindex = table_event->selectedrowindex.

READ TABLE i_result INDEX selectedrowindex INTO wa.

IF sy-subrc EQ 0.

CLEAR: imatfact1, iagrfact1, iagrhead1, iabgru1, v_part_detail,

selectedrowindex.

  • processing data

ENDIF.

In my DO_REQUEST:

****

result_view->set_attribute( name = 'i_result' value = i_result ).

result_view->set_attribute( name = 'iterator' value = me ).

result_view->set_attribute( name = 'selectedrowindex' value =

selectedrowindex ).

call_view( result_view ).

In my page:

<htmlb:tableView id = "result"

headerText = "Header Text"

onNavigate = "onMyNavigate"

selectionMode = "<%= v_sel_mode %>"

emptyTableText = "No data found matching your query!"

onRowSelection = "<%= v_onrow_sel %>"

table = "<%= i_result %>"

iterator = "<%= iterator %>"

visibleRowCount = "10"

selectedRowIndex = "<%= selectedrowindex %>">

<htmlb:tableViewColumns>

<htmlb:tableViewColumn columnName = "MATNR"

width = "100"

horizontalAlignment = "left"

title = "PART" >

</htmlb:tableViewColumn>

<htmlb:tableViewColumn columnName = "ZFLAG"

width = "100"

horizontalAlignment = "left"

title = "DISCOUNT" >

</htmlb:tableViewColumn>

</htmlb:tableViewColumns>

</htmlb:tableView>

I am also using the interface methods u tthere is no code inside:

IF_HTMLB_TABLEVIEW_ITERATOR~GET_COLUMN_DEFINITIONS

IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_ROW_START

IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START

Please suggest what could be wrong.

I have debugged this and saw the selected rowindex as '0' also but it gets applied somewhere again.

Thanks.

Former Member
0 Kudos

please take a look at SAP example in 6.20 : tutorial_4_mvc.

I have the same probelm as thsi example has, the only difference is the search criteria for authors is for me a text edit field(more than one value with tab separation).

When you enter a search in this example for Title as 'Dynamic Commerce' u get teh result and when u click on the radio button , u get the detail.

Now , whe nu do a new search for ex. C/C++, you get a result which is preselected.

I would like to deslect this in my case.

I am trying everything but no luck yet.

Please suggest.

Thanks.

raja_thangamani
Active Contributor
0 Kudos

Is your application stateful mode? If not debug why this is not getting cleared.

Raja T

Message was edited by:

Raja Thangamani

Former Member
0 Kudos

yes, it is stateful

raja_thangamani
Active Contributor
0 Kudos

May be thats causing a issue i feel. Is it necessary to be in stateful in your case? if not make it as stateless..

Or debug your program.

<b>*Reward each useful answer</b>

Raja T