cancel
Showing results for 
Search instead for 
Did you mean: 

Avoding Server Request on tableView MULTIEDIT

Former Member
0 Kudos

Hi All,

Is it possible to avoid server roundtrip when a line is selected from tableview onSelect="multilineEdit" ?

I have multiple tab strips, and on the third tab I have a table where the users can input info using dropdowns. However, everytime I select a line, the page refreshes and takes me back to the first tab with all tableView input lost.

Thanks!

Roman D.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Roman,

Try this in your tableview

onClientRowSelection = "javascript: htmlbevent.cancelSubmit = true"

Former Member
0 Kudos

Hi Arun,

Unfortunately, the system throws an error saying that onClientRowSelection has to be a boolean value...

Thank you!

Roman D.

Former Member
0 Kudos

You can use the following approach show in the code below:

CLASS CL_HTMLB_MANAGER DEFINITION LOAD.

* Optional: test that this is an event from HTMLB library.
IF event_id = CL_HTMLB_MANAGER=>EVENT_ID.

* See if upload is triggered from button
  DATA: event TYPE REF TO CL_HTMLB_EVENT.
  event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).

if  event->id = 'but1' and event->event_type = 'click'.
  DATA: tv TYPE REF TO CL_HTMLB_TABLEVIEW.
  tv ?= CL_HTMLB_MANAGER=>GET_DATA(
                  request      = runtime->server->request
                  name         = 'tableView'
                  id           = 'tab1' ).

IF tv IS NOT INITIAL.

 DATA: tv_data TYPE REF TO CL_HTMLB_EVENT_TABLEVIEW.
  tv_data = tv->data.
refresh itab2.
refresh itab3.


 call method tv_data->GET_ROWS_SELECTED
      receiving selected_rows = itab2.

 endif.
data : ind type SELECTEDROW,
       row_s type row.

if itab2 is not initial.
    data :rw LIKE LINE OF itab.

    loop at itab2 into ind.
      READ TABLE itab INDEX ind-index into
      rw.
       if rw is not initial.
       row_s = rw.
      append row_s to itab3.
      clear row_s.
      endif.
    endloop.
 endif.
Endif.

Itab2 type selectedrows.

in page attributes.

itab2 will contain the index of the selected rows in the table you are displaying say itab. Now your itab3 should also be as same type of itab. According to the code above, itab3 contains the selected rows from the itab.

All the selection happens in a single round trip in this approach.

Hope I am clear. If not you can revert back.

Hope this helps,

Regards,

Ravikiran.

Former Member
0 Kudos

Hi Ravikiran,

Thanks for such a detailed answer!

Former Member
0 Kudos

Ravikiran,

I still think on every click of selecting the row, the request goes back to the server and data of selected rows is stored inside the tableview object. only thing is we are not processing it and are processing of the data is done on a button click.

Let me know If i'm wrong.

But What I guess Roman needs is, he doesn't want the request to go back to the server at all on each row selection and wants to handle it on the client end and upon some submit button click, want only one request to go back to the server.

I'm not sure whether this is possible, bcos tableview internally uses a table to store the selected rows.

Regards,

Kumar

Former Member
0 Kudos

Hi Kumar,

You can try the code posted by me keeping a break point in the event handler. you can see no event triggered. I have checked that before I posted it. All the selected rows are populated into the table itab2(as in my code) at once. You can try that out and revert back.

Thanks & Regards,

Ravikiran.

Answers (0)