on 06-05-2009 2:56 PM
Hello,
I´ve created a normal table (not ALV) to display information. When the view is displayed, the table has the first row selected, when it shouldn´t be selected. I do not know to to avoid this.
I unchecked the check mark "Initialization lead structure" in the component controller for that structure and when I run the application, I get the following short dump:
Adapter error in &VIEW_ELEMENT_TYPE& "SYST_DESCR" of view "ZIAM.SYSTEM_VIEW": Context binding of property VALUE cannot be resolved: Lead selection not set for context node SYSTEM_VIEW.1.SYSTEMS
Can somebody help me ??
Thanks.
Hi,
Check for the table UI element for the same property.Selection mode as NONE. Is this set.
Regards,
Lekha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jorge,
I guess that the changes that you have made at your component controller level haven't got updated in your view. Just go to your views context, right click on it and say update mapping.
Your table row would get automatically selected on running your application only when "Initialization Lead Selection" is checked. (I assume that you haven't written any coding which you do anything like setting the lead selection. Coz this would be the only other possibility left out...) The selection mode of your table has nothing to do with the row being displayed as selected on startup.
Regards,
Uday
Hi,
I´ve updated the component controller in the view and nothing. I still get the short dump.
I deleted later the node and declared the node again. I still get the short dump.
And yes, there´s no code for the lead selection.
There are 3 nodes hanging from my component controller. One of them is the binding to the table and no one hangs from another as a subnode. 2 of them are declared as nodes in the view´s controller.
Hi,
To avoid dump, keep the 'Initialization lead selection' active(check this again), and to avoid lead selection you can do following.
Go to your table UI element properties tab in VIEW and go to the property 'selection mode' and the values you will see as below.
auto - None
single - single selection with lead selection active
multi - Multiple selection with lead selection active
none - No selection allowed in Ui
singleNolead - Single selection allowed in UI with no lead selection
MultiNolead - Multiple selection allowed in UI with no lead selection
The last two will disable the lead selection(but allow manual sel in UI) and based on your requirement you can go for the needed one.
Regards,
manne.
Ok, thanks. It works.
Unfortunately, now the problem is that I cannot get the selected row as before. The code gets always the first record and not the selected one:
DATA: lo_nd_systems TYPE REF TO if_wd_context_node,
lo_el_systems TYPE REF TO if_wd_context_element,
ls_systems TYPE wd_this->element_systems.
* navigate from <CONTEXT> to <SYSTEMS> via lead selection
lo_nd_systems = wd_context->get_child_node( name = wd_this->wdctx_systems ).
* get element via lead selection
lo_el_systems = lo_nd_systems->get_element( ).
* get all declared attributes
lo_el_systems->get_static_attributes( IMPORTING static_attributes = ls_systems ).
So the questions are: why do WebDynpro do this ?? and how do I get the selected node ??
Hi,
Get all the selected elements in the context node using the below code(using same example that you used above).
data: lo_all_sel_elements type WDR_CONTEXT_ELEMENT_SET,
lo_single element type IF_WD_CONTEXT_ELEMENT.
"get all the selected elements from UI
lo_all_sel_elements = lo_nd_systems->GET_SELECTED_ELEMENTS( )
"loop through all these elements and use the same method GET_STATIC_ATTRIBUTES
"to read the selected element data.
loop at lo_all_sel_elements into lo_single_element.
lo_single_element-get_static_attributes( importing static_attributes = ls_systems ).
endloop.
Regards,
Manne.
Edited by: Raja Sekhar Manne on Jun 8, 2009 12:33 PM
Edited by: Raja Sekhar Manne on Jun 8, 2009 12:35 PM
Hi Jorge,
Do you want the user to be able to select a single/multiple rows? If you want the user to be able to select multiple rows then you can set the tables "selectionMode" property to multiNoLead. You can then fetch all the rows selected by the user using the get_selected_elements method. Try check the code snippet below where i am fetching the rows selected by the user in 1 table & copying them to another table.
METHOD onactioncopy_selected_rows .
DATA: wd_node TYPE REF TO if_wd_context_node,
ls_node1 TYPE ig_componentcontroller=>element_node1,
lt_node1 TYPE ig_componentcontroller=>elements_node1,
lt_node2 TYPE ig_componentcontroller=>elements_node2,
wa_temp TYPE REF TO if_wd_context_element,
lt_temp TYPE wdr_context_element_set.
wd_node = wd_context->get_child_node( name = 'NODE1' ).
CALL METHOD wd_node->get_selected_elements
RECEIVING
set = lt_temp.
wd_node = wd_context->get_child_node( name = 'NODE2' ).
LOOP AT lt_temp INTO wa_temp.
CALL METHOD wa_temp->get_static_attributes
IMPORTING
static_attributes = ls_node1.
APPEND ls_node1 TO lt_node1.
CLEAR ls_node1.
ENDLOOP.
wd_node->bind_table( new_items = lt_node1 ).
ENDMETHOD.
If you however want the user to be able to select only 1 row then you can try set the "selectionMode" property to "singleNoLead". This is important that you either set it to singleNoLead/multiNoLead coz otherwise when you try to fetch the rows selected the system would be detecting 1 row less than the selected rows. This is because the system would consider the first row to be selected due to LeadSelection. The get_selected_elements doesn't capture any rows that you select by LeadSelection.
Regards,
Uday
Regarding the error that you get up on removing the, "Initialization Lead Selection" checkbox. Do you have any subnode created for your node & are trying to display its data in another table? Coz this seems to be a case of the subnode loosing track of its parents leadselection.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
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.