on 10-31-2008 4:32 AM
Hi All,
I have a rereqirement that i have to change lead selection when i click on any column of any row of a table.like I have 6 rows in my table and when i click on any of the column of 4th row this row get selected means lead selection should be set on this row and after that when i clik on any column of 1st row it should get changed to 1st row .i need wn i click on any column the lead selection should get changed.can any one suggest what to do?
Regards
Govi
Hi Govinda,
If I understand your requirement right, what you want to achieve is this:
You have a table , say with 3 rows, 6 columns.
Your requirement is that when you click on any cell , the corresponding row gets lead selected.
Now, this would depend if the individual cells are TextViews or InputField Elements.
If its a text view, there is no other option other than actually selecting the row manually. Since there are no events defined for a TextView Element.
If you are using an inputfield as the UI Element for the table column (Each cell in the column is a Input Field in this case), even then, you could define an event only on "OnEnter" and not on Click, since the InputField UI Element supports only OnEnter event.
(If u want the cells to be non editable, then instead of making them as TextView elements, create them as InputFields and check the readOnly property)
Now, if its ok that instead of clicking on the cell, if when you hit enter on the cell you want the corresponding row to get selected, here is the code:
First of all create an Action set_lead_selection and implement the corresponding method onactionset_lead_selection as follows:
METHOD onactionset_lead_selection .
DATA lo_nd_table TYPE REF TO if_wd_context_node.
DATA lo_el_table TYPE REF TO if_wd_context_element.
DATA ls_table TYPE wd_this->element_table.
* navigate from <CONTEXT> to <TABLE> via lead selection
lo_nd_table = wd_context->get_child_node( name = wd_this->wdctx_table ).
CALL METHOD wdevent->get_context_element
EXPORTING
name = 'CONTEXT_ELEMENT'
RECEIVING
value = lo_el_table.
CALL METHOD lo_nd_table->set_lead_selection
EXPORTING
element = lo_el_table.
ENDMETHOD.
Once the code is in place, assign this action to the event OnEnter for each table column.
Now when you hit enter on any cell in the table, the corresponding row should get selected.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
At least in 7.01 we have an event on the table called onColSelect:
http://help.sap.com/saphelp_nw70ehp1/helpdata/en/2d/390e422dfcde2ce10000000a1550b0/frameset.htm
Hi Govi,
i don't know if your problem is already solved or not, but you can see this two threads. Both are assigned as solved. I think the purpose of these 2 threads is similar to yours.
1. regarding selection of row? (from 30. sept)
2. Selecting a row without the lead selection (from 19. sept)
you can find them by searching in the forum.
good luck
Kind regards, Haleh
Edited by: Haleh Mir Ashrafi on Nov 25, 2008 10:48 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Govi,
Let me try to understand what you exactly intend to do. Suppose you have 2 columns COL1 & COL2. If the user clicks on the header of COL1 then you want to set the lead selection for the 1st row of the table. If he clicks on the header of COL2 then you want to set the lead selection for the 2nd row of the table. If thats what you intend to do then continue reading below:
1) Go to the layout of your view and go to the properties of your column. You will have an onAction event for your column. So for this event create an method say COLSELECTED1. Create separate events for each column of your table this way.
2) Within the coding for these methods set the lead selection of your table. Say suppose you have created an action COLSELECTED1 for 1st column of your table then when the user clicks upon this column you would want the lead selection to be set to 1. So consider your coding to be like shown below:
method ONACTIONCOLSELECTED1 .
DATA lo_nd_node TYPE REF TO if_wd_context_node.
* navigate from <CONTEXT> to <NODE> via lead selection
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
lo_nd_node->SET_LEAD_SELECTION_INDEX( index = 1 ).
endmethod.
Similarly for 2nd column create a method for the onAction event of column 2 & put the below coding into it.
method ONACTIONCOLSELECTED2 .
DATA lo_nd_node TYPE REF TO if_wd_context_node.
* navigate from <CONTEXT> to <NODE> via lead selection
lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
lo_nd_node->SET_LEAD_SELECTION_INDEX( index = 2 ).
endmethod.
Now when you click upon the 1st column header the lead selection is set to 1st row & when you click on the 2nd column header the lead selection would be set to the 2nd row.
Hope this helps resolve your problem.
Regards,
Uday
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
Can u expalin why u need multiple lead selections get changed . For ur requirement u can read the current index from in the Element and set it it to the Node using SET_LEAD_SELECTION_INDEX method. or use SET_LEAD_SELECTION by passing element.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi ,
actually i dont want multiple lead selection .what i need that wn i click on any column of a row that row shud get selected.it is happening in WD java but not in wd ABAP.wt i m doing now is explicitly select the row and then go to that column and fill the value.i need that i directly go to that column ,the row shud get selected(i.e the lead selection shud get changed to that row) and i can fill the value and manipulate the other thngs accordingly.
regards
govi
Hi,
I think u want edit the particular row field when you are selecting the table ..In the Action Event in the Select
Add CONTEXT_ELEMENT type ref to IF_WD_CONTEXT_ELEMENT in the parameters (after the WDEVENT ) . Now use the method get_attribute to get the value from the context_element there. and u can directly edit the field there.
For Eg .
In a table there are three Columns 1. Quantity
2. Price
3. total
say price is input field. after entering the field Price the total should update .
then in the Action i will add CONTEXT_ELEMENT as stated above in the parameters.
then
Context_element->get_attribute( exporting name = 'QUANTITY' importing value = lv_quan ).
Context_element->get_attribute( exporting
name = 'PRICE' importing value = lv_quan ).
Now calculate
lv_tot = lv_quan * lv_price.
now insert new Value to the Context.
Context_element->set_attribute( exporting name = 'TOTAL' value = lv_tot ).
i
User | Count |
---|---|
93 | |
10 | |
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.