on 01-27-2014 10:58 AM
Hi All,
I have added Filter in Table UI element and able to filter the data. Also i have a button "Select All" (Toolbar button)
One of the columns in table is check box . If i enable filter and selecting check box for 5 rows.
Then if i click on "Select All" only the filtered rows needs to be selected.
Inside this "Select All" action, how can i get the filtered table data.
Appreciate responses. Thank you
PS: Referred blog for creating Filter in Table UI element
Regards
Vinoth
Hi Vinoth,
For your requriement you have to add your own logic. Say create one more attribute of type char1 in table context node and call it as Record type. After filtering records, if user has selected 5 check boxes means edited 5 rows, while editing check box, on event handler of check box, mark the record type as 'U'. So,if user edits 5 rows, all the 5 records will have new field Record_type as 'U'. U for updated.
so,clicking on select all button,filter from the table so that you can get only this 5 records,
Delete lt_table where record_type ne 'U'.
Hope this is helpful for you.
Regards,
Ravikiran.K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ravi,
Thanks for reply. As mentioned, i have "Select All" button on top of table. First i will filter the table data (lets say filtered 5 rows from 10 rows).
Then if i click "Select All" button, inside this action method i need to get the filtered table data and i can mark the record (filtered table data) with some indicator.
Regards,
Vinoth
Hi Vinoth,
You can do this way. When user clicks on Select All button, first you read the filterd value from the table. Suppose user has filtered on the First column, then get the First columns filter value . you can get by reading the Filter node.
Example : user has entered
firstcolumn = *c*
Select Records by quering on DB table using where condition on the first column, by converting c to Capital C and replace * with % and then you will get the filtered values.
select *
from Dbtable
into lt_table
where first_column like '%C%;.
lt_table will have filtered values.
Note : where clause of select query varies based on the filter value entered on the table columns. In above example user has entered on only first column, if it is entered for two columns filtered include the two fields in where clause.
Regards,
Ravikiran.K
Hi Vinoth,
You can read the filtered table data by using method GET_TABLE_DATA( ) of method handler
Please write the below code in the event handler of "SELECT_ALL" action
DATA lt_data TYPE wdr_table_row_data_tab.
DATA ls_data LIKE LINE OF lt_data.
"get filtered table data
lt_data = wd_this->go_method_handler->get_table_data( ).
LOOP AT lt_data INTO ls_data.
* ls_data-context_element->get_static_attributes(
* IMPORTING
* static_attributes = "?
* ).
" To select the row
ls_data-context_element->set_selected( flag = abap_true ).
ENDLOOP.
Hope this resolves your issue.
Regards,
Rama
Message was edited by: Ramakrishnappa Gangappa
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.