Skip to Content
avatar image
Former Member

Change Lead Selction in Table on click of any element in row?

Hi @,

In My application I am using Table to display some data now the requiremnt is to change the row selection by selecting any thing in that row rather than changing row selection manually.

Is it possible to change row selection whenevr user clicks on any of the row in the table.?

Regards

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

10 Answers

  • Best Answer
    avatar image
    Former Member
    Oct 20, 2008 at 05:52 AM

    Hi Amit,

    Your Question: "It is possible to change it when LinkToAction is clicked."

    Yes it is possible to change, you need to get the row number of the LinkToAction Ui element which has been clicked; call the method setLeadSelection() on the node binded to table in the action of LinkToAction UI element and pass the row number to the method setLeadSelection().

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I remember that stuff working in earlier versions of Web Dynpro. But with 7.10 CE it seems to be broken?

      With reading further on this I found a solution (regards to Armin reichert) working in 7.10:

      1. Create a Parameter on your ACTION you want to call by the LinkToAction element of type IWDNodeElement

      2. Rightclick the LinkToAction Element an select "Parameter Mapping" from menue.

      3. Map your Parameter with nodeElement on the left

      4. Program in your action something like:

        public void onActionLinkToAction(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, com.sap.tc.webdynpro.progmodel.api.IWDNodeElement myNode )
        {
          //@@begin onActionSelectService(ServerEvent)
         wdContext.node<yourNode>().setLeadSelection(myNode.index());
          //@@end
        }
      

      That will set the Lead selection to the row of the selected LinkToAction 😊

  • avatar image
    Former Member
    Oct 18, 2008 at 08:19 AM

    Hi Amit,

    To check which element is selected you need to iterate over the node and check which element of the node is selected, you can use isSelected() method for it. now you will get the count and element that is selected, pass the count to method setLeadSelection(int) on the node that is binded with your table.

    In your table rather then using a text view to dispaly data use Link to action Table Cell Editor, you can change the desing of the link and you will get an action associated with each element in the table.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi ,

      Thanks for your reply but i have one question I am not using link to action first and all the elements of row are textview then to iterate ove the nodes is fine but what will be the action that will trigger this operation .

      As I know there is no action which will trigger this.

      Regards

  • avatar image
    Former Member
    Oct 18, 2008 at 09:53 AM

    Hi Amit,

    As per the default property of a table in web dynpro if a user selects any element (cell) of a row the complete row is selected. And if you are using text view in all the elements of the row you don't need to worry about setting lead selection action...

    just write a method for onLeadSelect to capture the data of the current selected row and rest will be taken care of by WDF.

    OnLeadSelect is the action that checks which row is currently selected.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 17, 2008 at 06:12 PM

    Hi Amit,

    There would be an event called onLeadSelect, create an action for this and just write this line make the lead selection to 0.

    wdContext.node<nodename>().setLeadSelection(0);

    Regards,

    Murtuza

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Oct 18, 2008 at 04:42 AM

    Hi Amit,

    Whenever a user selects a row in the table the lead selection changes unless you

    haven't set the initializeLeadSelection Property of the node mapped to table to false.

    If you wish to capture the data of the row selected; you have to define an action and

    map it to onLeadSelect event (in table property you will find an Event call onLeadSelect)

    and write the code to get the data in that action.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Murtuza/Aishwarya,

      My requirement is to change lead Selection when User clicks on any field in any row to corresponding row whose element has been clicked.

      I hope now I am clear as it was slightly ambigous before in explanation.

      I can set the leadselection not issue but what will be the event associated when user clicks on any element in the row and how to determine the row element clicked will be issue.

      As per my knowledge this is not possible need your help on this.

      Regards,

      Amit

  • avatar image
    Former Member
    Oct 18, 2008 at 11:24 AM

    Hi Amit,

    Yes, it is true that lead select action works only on the row and not a single cell. But whenever you click on any cell of the row the whole row comes as selected if you havent changed the selectionMode, selection change behaviour or initiallize lead select property.

    There is no such action in web dynpro as cell select.

    That's why for your cell select I gave you a work around of using link to action instead of text view to display your cell data.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi @,

      Any help in this how to go abt.

      My Table is having LinkToAction UI in one of the columns. When click on the cells other than the Linktoaction LeadSelction changes but the same doesn't work when I click on the LinkToAction element.

      It is possible to change it when LinkToAction is clicked.

      Regards

      Edited by: Amit on Oct 20, 2008 7:03 AM

  • avatar image
    Former Member
    Oct 20, 2008 at 05:03 AM

    Hi Amit,

    The default properties are as follows:

    Table Property: selectionMode --> auto

    selectionChangeBehaviour --> auto

    rowSelectable ---> true

    Context Property: initializeLeadSelection --> true

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Aishwarya,

      In My Application I have all these properties as you have mentioned.

      Now the issue is LinkToAction doesn't change the LeadSelection.

      Also the DropDownByIndex element has changed to textview.

      REgards

  • avatar image
    Former Member
    Oct 20, 2008 at 07:04 AM

    Hi,

    I am not sure what is your problem, but i think you can solve your problem by inserting table columns individually and not table has a whole. Such that you can bind to the attribute you needed.

    Regards

    Raghu

    Add comment
    10|10000 characters needed characters exceeded

  • Nov 12, 2008 at 12:39 PM

    Hallo Amit,

    have a look at my article on [New Web Dynpro Sample available - Enhancing Table Performance|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/2343] [original link is broken] [original link is broken] [original link is broken];. You find more details on lead selection change behavior and table action eventing there.

    Regards, Bertram

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Nov 19, 2008 at 10:52 AM

    Hi Frank, Bertram,

    Thanks a lot, this helped me.

    Rgds,

    Atul.

    Add comment
    10|10000 characters needed characters exceeded