on 11-08-2011 3:03 AM
Hi experts,
Recently, I am working on multi-selection in table rows. When selected one line, then I pressed CTRL and de-selected it. Then I got index = 2- by method GET_LEAD_SELECTION_INDEX. Here I found when the node selection mode is not 1..1, it will lead to some unpredictable result.
Here comes the question:
1 what does Get lead selection mean? What does 'LEAD' mean?
2 Why I got the index = -2, what does it mean? Any other result that could be returned?
Thanks for reading.
Hello Yichao,
-2 means there is no selection. in the sense there are no lead selected element in that context. you refer the constant IF_WD_CONTEXT_NODeE-> NO_SELECTION.
GET_LEAD_SELECTION_INDEX method will return -2 if there is no lead selected element otherwise it will return the index of the lead selected element.
BR, Saravanan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks both!
But vinoth rajendran, when selection is more than 1 lines for the context node, and I select several lines with CTRL or de-select line with CTRL, what will happen?
For example, I made a test, the 1st, 2nd , 3rd line were selected, and I de-selected the 1st line, the index of lead selection is 2.
I think the leading selection means the 1st selected row. When the selection mode is 1..1, this is which row selected currently. When the mode is 0...n, I think it is the 1st row you selected. All the rest rows will be found in method get_selected_elements().
And I guess, I did not put it into practice, when you set the selectionMode in VIEW UI editor as mutiple line without lead, all the selected rows will be found in get_leading_elements().
So in conclude, the leading selection is for the 1st selected row.
The below link can be referred:
http://help.sap.com/saphelp_nw70/helpdata/en/38/c5bacc91a345eda17f2903491c391d/content.htm
Thanks for the help of all of you! I close the topic now.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
> Here comes the question:
> 1 what does Get lead selection mean? What does 'LEAD' mean?
> 2 Why I got the index = -2, what does it mean? Any other result that could be returned?
2. getting negative index means there is no row selected.
for e.g. in bleow code, i am setting lead seletion as -1 , it means when the ALV is displayed, 1st row will not be selected.
get element via lead selection
lo_el_node_alv_output = lo_nd_node_alv_output->get_element( ).
lo_nd_node_alv_output->set_lead_selection_index( -1 ).
lo_nd_node_alv_output->bind_table( it_alv[] ).
then if user selects mutiple rows using cntrl key, you can use below coding to read those selected entries,
navigate from <CONTEXT> to <NODE_ALV_OUTPUT> via lead selection
lo_nd_node_alv_output = wd_context->get_child_node( name = wd_this->wdctx_node_alv_output ).
Get element via lead selection
lo_el_node_alv_output = lo_nd_node_alv_output->get_element( ).
lt_element = lo_nd_node_alv_output->get_selected_elements( ).
I hope this will help you.
Thanks,
Chandra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
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.