Skip to Content
author's profile photo Former Member
Former Member

onClientRowSelection for tableView's

Hi,

I'm working on a portal application which utalises epcf eventing to allow an iView to send messages another iView. Basically a table is displayed in the left iView and, depending which row the user selects, a message containing data from the selected row is sent to the right iView.

I initialy tried to utalise the onClientRowSelection('javascript') feature of the tableView htmlb element (with selectionMode="SINGLESELECT") which is supposed to invoke a javascrip function whose name is supplied as a parameter. However, after spending some time fudging trying to get it working, I was eventually took another route and turned one of the cells into a link.

I was wondering whether anyone else has had any experience using onClientRowSelection and were successful in calling some javascript.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 10, 2005 at 01:04 PM

    Thanks Detlev,

    That helps. I was doing something along the lines of:

    <script language="JavaScript">

    function onRowSelect(eventObj){

    alert("Received message from" + eventObj.sourceID + ":" + eventObj.dataObject);

    }

    </script>

    <hbj:tableView

    id="myTableView"

    .....

    width="200"

    onNavigate="onNavigate">

    <%myTableView.setOnClientRowSelection("onRowSelect");%>

    .....

    </hbj:tableView>

    Thinking that the setOnClientRowSelection would invoke the onRowSelect function in the javascript.

    One more question...

    I'd like to use this approach to raise an epcf event i.e.

    myTableView.setOnClientRowSelection("EPCM.raiseEvent(<urn>, <eventName>, <objectData>, <sourseID> )");

    would you by any chance know how to pass data from the selected row to <objectData>?

    Add a comment
    10|10000 characters needed characters exceeded

    • Hi Sergio,

      > Thinking that the setOnClientRowSelection would

      > invoke the onRowSelect function in the javascript.

      The event object exists, it's not passed, see below.

      > how to pass data from the selected row

      > to <objectData>?

      <%@ taglib uri="tagLib" prefix="hbj" %>
      <jsp:useBean id="model" scope="application" class="com.sapportals.htmlb.table.DefaultTableViewModel" />
      <%@ page import="com.sapportals.htmlb.TreeNode"%>
      <hbj:content id="contentID" >
        <hbj:page title="pageTitle">
          <hbj:form id="formID" >
            <hbj:tableView
              id="myTableView"
              selectionMode="SINGLESELECT"
              model="model"
            >
              <% myTableView.setOnClientRowSelection("showUpTableContent()"); %>
              <% myTableView.setJsObjectNeeded(true); %>
            </hbj:tableView>
          </hbj:form>
        </hbj:page>
        <script language='JavaScript'>
        function showUpTableContent(){
          alert('it was a row ' + htmlbevent.obj.getClickedRow());
        }
        </script>
      </hbj:content>

      See https://forums.sdn.sap.com/thread.jspa?threadID=26395 for methods which exist on HTMLB TableView JS object. To retrieve a certain value, set the key column in your table.

      Hope it helps

      Detlev

  • Posted on Feb 10, 2005 at 12:28 PM

    Hi Sergio,

    there is no problem at all:

    <%@ taglib uri="tagLib" prefix="hbj" %>
    <jsp:useBean id="model" scope="application" class="com.sapportals.htmlb.table.DefaultTableViewModel" />
    <%@ page import="com.sapportals.htmlb.TreeNode"%>
    <hbj:content id="contentID" >
      <hbj:page title="pageTitle">
        <hbj:form id="formID" >
          <hbj:tableView
            id="myTableView"
            selectionMode="SINGLESELECT"
            model="model"
          >
            <% myTableView.setOnClientRowSelection("alert('hurrah, a row has been selected')"); %>
          </hbj:tableView>
        </hbj:form>   		
      </hbj:page>
    </hbj:content>

    ... just works.

    Hope it helps

    Detlev

    PS: Please consider rewarding points. Thanks in advance!

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.