on 10-11-2010 10:59 AM
Hi Experts,
Deselection is posible in table? in table user selecting one row after that if user click outside the table or at any place in that view or again select that selected row, that time i want to deselect the selection? is it possible ? how can we achieve this...
Thanks,
kris
Hi ,
You can achieve this feature the way we have in sap ABAP screen programming. means, if you select the row, it is selected and if you select the row selection button again, it will be deselected.
Create 2 attributes in component controller: ACTION_NAME type string and INDEX of type integer ( I )
in method WDDOBEFOREACTION, capture the action name in attribute ACTION_NAME
Now go to the method WDDOMODIFYVIEW and write the below code
method WDDOBEFOREACTION .
data lo_api_controller type ref to if_wd_view_controller.
data lo_action type ref to if_wd_action.
lo_api_controller = wd_this->wd_get_api( ).
lo_action = lo_api_controller->get_current_action( ).
if lo_action is bound.
wd_comp_controller->action_name = lo_action->name.
endif.
endmethod.
Create one action say 'LEADSELECT' and attach it with the event OnLeadSelect event of the table. No code is required in this event handler.
In WDDOMODIFYVIEW method of the view, write the below code:
METHOD wddomodifyview .
*Assume this is the node which holds the table data
DATA lo_nd_flight TYPE REF TO if_wd_context_node.
DATA lo_el_flight TYPE REF TO if_wd_context_element.
DATA ls_flight TYPE wd_this->element_flight.
DATA lv_index TYPE i.
IF wd_comp_controller->action_name = 'LEADSELECT'.
lo_nd_flight = wd_context->get_child_node( name = wd_this->wdctx_flight ).
*Get the currently selected row ( if any )
CALL METHOD lo_nd_flight->get_lead_selection_index
RECEIVING
index = lv_index.
*This condition is to ensure that if the same row is clicked again, it is unselected
IF wd_comp_controller->lv_index EQ lv_index AND wd_comp_controller->lv_index IS NOT INITIAL.
*Below methods call will make sure that lead selection is removed
CALL METHOD lo_nd_flight->clear_selection.
lo_nd_flight->set_lead_selection_index( '-1' ).
CLEAR wd_comp_controller->index.
ELSE.
wd_comp_controller->index = lv_index.
ENDIF.
ENDIF.
ENDMETHOD.
Now launch your application any just use the button in first table column to select/unselect the table row
Thanks
Vishal Kapoor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
I believe you were looking for some action like 'outOfFocus' which woud have been availabl in Javascript.
But the same thing is not supported by Wd Java.
Thanks,
Jakes.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi All
To deselect selected row when u click again i used following code, but not working... can anyone help me please ..
data: lr_node type ref to if_wd_context_node.
data: lr_element type ref to if_wd_context_element.
data: lt_elements type WDR_CONTEXT_ELEMENT_SET.
lr_node = wd_context->get_child_node( 'HGT_EMP_CARRIER_ESS' ).
lt_elements = lr_node->get_elements( ).
loop at lt_elements into lr_element.
if lr_element->is_selected( ) is not initial.
lr_element->set_selected( abap_false ).
exit.
endif.
endloop.
Thanks,
kris.
Edited by: kissnas on Oct 19, 2010 6:05 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
not solved. Closing this .
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You may use below code to unselect the row in the table.
lo_nd_node_oa_level1->set_lead_selection_index( if_wd_context_node=>no_selection ).
Regards,
Naresh kumar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kris,
Yes, Deselection is possible in a table.
You could use CLEAR_SELECTION method of if_wd_context_node to achieve it and u could apply any logic to achieve it, you just have to use this method to do so.
Regards
Anurag Chopra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
There could be another possiblity of achieving the same, but for the current context I think, you can maintain an attribute in the table of type WDY_BOOLEAN and set this to ABAP_TRUE when the user selects and changes any of the input field or selects a dropdown value or checks any check box, under WDDOMODIFYVIEW.
If the user doesn't make any of the above actions even after selecting, then use the CLEAR_SELECTION method of if_wd_context_node.
One of the possibilities to get the action from the table itself.
If you don't have any of the dropdowns, input fields or check boxes, let us know. Will look for further possibilities.
Regards,
-Syed.
Hi Kisan,
There are two things which you need to do
1) Capture the user action on the view, If the user clicks on the view part which doesnt have any ui element, it doesnt call wddomodifyview method of the view, I am not sure how do we capture this but we could capture if a user selects any other ui element.
2) Once you have the info on whether the user has selected a row of the table u dont have to do anything but if it selects any other ui element you could call the clear selection method of the node associated with the table.
I would not suggest that you have another variable to capture the user action, you could use the method
current_action_info of if_wd_view_controller.
Regards
Anurag Chopra
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.