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.
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>?
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