Skip to Content
avatar image
Former Member

table lead selection

Hi Colleagues,

Here is the problem with tables selection

Depending upon the node size in the context i.e. if the nof elements is 4 i am displaying 4 tables in the output, where each table has three culms and one row containing test, text and Button elements

on click of button i am triggering an action which should display some other attributes of the particular node element(i.e. filesize, filename,title etc)

here my output has three tables where on click of the button in any table it is displaying the same element values

*on action of the button i have coded this*

public void onActionGetThesecuritydetails(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent ) 
  { 
String URL = wdContext.currentElementsElement().getURL(); 
String Filename = wdContext.nodeElements().getCurrentElement().getAttributeAsText("fileName"); 
}

but on click of buttons in the tables i am getting the same output (which should not be same)

i think on click of button that particular tgable element needs to selected and this should be sent to the action and we have to get that element attributes

could anyone help me how to achieve this?

Thanks & Regards

Swetha

Edited by: Swetha Nellore on May 13, 2009 4:21 PM

Edited by: Swetha Nellore on May 13, 2009 4:23 PM

Edited by: Swetha Nellore on May 13, 2009 4:27 PM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    May 14, 2009 at 07:35 AM

    Please post your exact context structure and explain how you have bound the tables to the context.

    Armin

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      You need to add a Source Mapping to your UI element. Then, whenever WDP executes your action it will add the Element you want into your action.

      I think you can find some examples in the forum, tell me if you still have problems.

      Regards,

      Daniel

  • avatar image
    Former Member
    May 13, 2009 at 02:46 PM

    Hi,

    Why not use a row repeater instead of Table. You will get help regarding this if you search the forumn.

    Use parameter mapping for your scenario

    Regards

    Ayyapparaj

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Ayyapparaj,

      Using rowrepeater i am not able to get exactly the actual look of the screen( SM requirement).So i took this option.

      Here in the reply you have mentioned to use parameter mapping, could you please expalin me with some peice of code

      Here is the code i have used to configure the button inside the table

      IWDTableColumn column2 = (IWDTableColumn) view.createElement(IWDTableColumn.class, null);
       table.addColumn(column2);
        //Create 3rdst TableCellEditor and bind it to an attribute of the Elements node in the context 
        IWDButton editor2 = (IWDButton) view.createElement(IWDButton.class, null);
        IWDTextAccessor textAccessor = wdComponentAPI.getTextAccessor();	
        String lViewText = textAccessor.getText("install");
        editor2.setText(lViewText);				
        IWDAction thisAction  = view.getAction("GetThesecuritydetails");	
        IWDGridData celleditor2 = editor2.createLayoutData(IWDGridData.class);
        celleditor2.setVAlign(WDCellVAlign.MIDDLE);
       celleditor2.setPaddingTop("100px");				
        editor2.setOnAction(thisAction);
       editor2.setVisible(IWDUIElement.DEFAULT_VISIBLE.VISIBLE);
        editor2.setEnabled(true);
       column2.setHAlign(WDTableColumnHAlign.CENTER);				
       column2.setTableCellEditor(editor2);		
      column2.setWidth("20%");

      on this Action "GetThesecuritydetails" i am calling this code

      public void onActionGetThesecuritydetails(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        {
          //@@begin onActionGetThesecuritydetails(ServerEvent)
      	  
      	  
      	  
        com.sap.tc.webdynpro.progmodel.api.IWDView view;		  
        String URL = wdContext.currentElementsElement().getURL();
        String Filename = wdContext.nodeElements().getCurrentElement().getAttributeAsText("fileName");
      }

      Please let me know how to code the parameter mapping

      Many Thanks & Regards

      Swetha

  • avatar image
    Former Member
    May 15, 2009 at 03:08 AM

    Hi,

    From your question, what i have understood is,

    You have created 3 (.e.g) indepenant tables and in each table you have 1 row and a botton in one coulmn.

    when you click on the button you should get the details of the elements node from whcih you created these independant tables.

    is that correct..If that is the case.

    the tables you have created has no relation with the node element. it has only relation with the iterateelemnts node. If you keep the iterate node under the elements node in the context and if you can put the created tables under the main table of elements table in the layout, then your scenario works out.

    that is when you click on the first table the lead selection of elements node changes and you will be able to display the details of it.

    AM

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi,

      Thanks a lot for all your replies.I have got a solution for this

      i.e i am passing parameters along with the action using

      mappingOfOnAction.setString()
      //Create column3 
        IWDTableColumn column2 = (IWDTableColumn) view.createElement(IWDTableColumn.class, null);
        table.addColumn(column2);
        //Create 3rdst TableCellEditor and bind it to an attribute of the Elements node in the context 
        IWDButton editor2 = (IWDButton) view.createElement(IWDButton.class, null);
       IWDTextAccessor textAccessor = wdComponentAPI.getTextAccessor();	
        String lViewText = textAccessor.getText("install");
        editor2.setText(lViewText);			
        IWDAction thisAction  = view.getAction("GetThesecuritydetails");	
        IWDGridData celleditor2 = editor2.createLayoutData(IWDGridData.class);
       celleditor2.setVAlign(WDCellVAlign.MIDDLE);
        celleditor2.setPaddingTop("100px");				
        editor2.setOnAction(thisAction);
        *editor2.mappingOfOnAction().setString("filename", element2.getFileName());*
         *editor2.mappingOfOnAction().setString("displayurl", element2.getURL());*
       *editor2.mappingOfOnAction().setString("token", element2.getURLLabel());*
      			 
        editor2.setVisible(IWDUIElement.DEFAULT_VISIBLE.VISIBLE);
      editor2.setEnabled(true);
        column2.setHAlign(WDTableColumnHAlign.CENTER);				
       column2.setTableCellEditor(editor2);		
       column2.setWidth("20%");	

      So i am getting the exact element details on click of action and in the action i am able to get them without using any context related coding

      public void onActionGetThesecuritydetails(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent, java.lang.String filename, java.lang.String token, java.lang.String displayurl )
        {
          //@@begin onActionGetThesecuritydetails(ServerEvent)
      	  
      	  
      	  
      	  String file = filename;
      	   String finalurl = displayurl;
      	   String title = token;
      
      }

      Thanks & Regards

      Swetha

  • avatar image
    Former Member
    May 15, 2009 at 04:08 AM

    Got the info from some forum thread and solved it by myself

    Add comment
    10|10000 characters needed characters exceeded