on 09-22-2008 2:25 PM
Hi,
My requirement is:
I have a table view in which I can select multiple rows.
I will be selecting some rows, and pressing a button.
Functionality of button is written in Javascript, to open a popup window.
But how will I capture which all rows were selected ?
Should I use a Java code or ABAP code ?
And where should I put that code ?
I tried calling the method cl_hrrcf_iterator=>get_tv_attr in the Javascript of the button. But it doesnt work. But if its in DO_HANDLE_DATA it works. Why is it like that ?
Is it possible in BSP, to use the function htmlbevent.obj.getSelectedRows() ? If so, how should the code be ?
Could you please tell me some of the possible solutions.
Would definitely appreciate quick replies.
Thanks,
Nisha Vengal.
Hi Nisha,
You can do as follows:
data: begin of st_row_idx,
row_idx type i,
end of st_row_idx.
data: itab_row_idx type table of st_row_idx.
data: wa_row_idx like line of it_row_idx.
IF event IS NOT INITIAL AND event->event_name = htmlb_events=>tableview.
tv_event ?= event.
CASE event->event_server_name.
WHEN 'MyEventRowSelection'.
wa_row_idx-row_idx = tv_event->selectedrowindex .
READ TABLE itab_row_idx INTO wa_row_idx WITH KEY row_idx = wa_row_idx-row_idx.
IF sy-subrc = 4., <---if the current selected row is not already in itab_row_idx
APPEND wa_row_idx TO itab_row_idx.
endif.
ENDCASE.
ENDIF.
Then you have indices of all selected rows in table itab_row_idx .
Hope it helps,
Anubhav.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
No, put that code in DO_HANDLE_EVENT .
For this code to work properly , you must declare ITAB_ROW_IDX in page attributes of view and make the application stateful or define ITAB_ROW_IDX as class attribute
because each time the page is refreshed itab_row_idx will be initialised , so to retain its contents we need to do one of the above things....
Hope its clear to you.
Regards,
Anubhav.
Hi Nisha,
You can have the ABAP code itself. I had also faced with then same issue. Use the below piece of code form your requirements.
In *IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_ROW_START*
* Data : M_ROW_REF type <Structure type>
*m_row_ref ?= p_row_data_ref*
In *IF_HTMLB_TABLEVIEW_ITERATOR~RENDER_CELL_START*
* DATA : CHK TYPE FLAG
*case p_column_key.*
when ' <Column Name>'.*
CHK = m_row_ref-><Column Name>.*
p_replacement_bee = CL_HTMLB_CHECKBOX=>FACTORY(
id = p_cell_id
checked = CHK ).
In *Do Request*
Data : loc_table_event type ref to cl_htmlb_event_tableview
call method cl_hrrcf_iterator=>get_tv_attr
exporting
p_tv_id = '<Tabe View ID'
p_component_id = me->component_id
po_request = me->request
importing
po_tv_event = loc_table_event.
The above methods are used to get the values which are selected in the table view and operated further.
Reward points if useful.
Regards,
Gokul.N
Hi,
Check the method GET_ROWS_SELECTED of class CL_HTMLB_EVENT_TABLEVIEW ..
Regards,
Anubhav.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.