on 02-10-2005 11:09 AM
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>?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.