on 12-17-2004 4:33 PM
Hi,
Is it possible to have the Scripting Events call into my PortalComponent?
I want to get notified when a row in a table is clicked.
The table doesn't have a Click event or equivalent
but there is a SAPTABLECLICK scripting event which sounds promising (depending on the info it gives me)
There is also an event mentioned in the help called SAPTABLECELLCLICK which sounds perfect but I amn't even sure how to put a handler under that since it doesn't appear in the properties of the table
The examples I have seen all use the events to comunicate between iViews but nothing to talk to the component
Vin
Hi,
1. In the properties editor, when the table is selected, choose ItemTemplate > Cells > [<i>The name of the column you want to add the event to</i>] > TableCellContent.
2. Add event handler to TEXTVIEWCLICK (e.g. <i>onCellClick</i>)
3. Add the script to the ascx file:
<i><script>
function onCellClick(id, event)
{
alert(event.srcElement.innerText);
}
</script></i>
I hope that this is what you are looking for.
Yossi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks, that's part of what I was looking for
The main part was how to call into my portal component
so to replace
alert(event.srcElement.innerText);
with
PortalComponent.MyFunction(id, event);
that way I can use the click to get the key of the row and then perform a few actions based on that
Is that part possible?
It might help if I explain the app I am writing (its not very complex)
I have a list of events from my system
I am displaying them in a table
with EventId, Start Time and Stop Time as the columns
when the user clicks on an event (preferably anywhere on the row but if it's only on the ID column I can live with it)
I will fill another table with more detail on the event
Vin
Hi,
Ok, now that I understand more about what you want to develop, I can suggest two options to develop it:
1.
Develop two portal components. One that shows the first table with the list of events and the second that shows the details of a specific event.
Then put them on the same page and use the Portal client side events mechanism to send the information from the first iView to the second (there is a tutorial that shows how to pass events between iViews).
2.
Use the LeadSelect event and get notification when a row is selected.
You can look at the following tutorial that I believe is very similar to what you are looking for. Connecting to SAP NetWeaver Systems - Details Form Tutorial (https://media.sdn.sap.com/html/submitted_docs/PDK_for_dotNET_10/Tutorials/Connector/Details%20form.htm)
I hope that would help you more.
Yossi
I was trying to get LeadSelect to work at the same time as trying to get this to work
The example doesn't contain enough info for what I was trying to do but my question on it got answer today so I'll go with that approach.
Out of curiosity I would like to get it working the other way too
The tutorial shows comunuication between 2 iViews but as with the code you gave me it is comunication between the 2 HTML pages, it sends an event which is caught by another HTML script, it doesn't show how to get the event back into the Portal Component
unless I am looking at the wrong example
https://media.sdn.sap.com/html/submitted_docs/PDK_for_dotNET_10/Tutorials/Client%20Side%20Events.htm
Vin
I must be missing something really obvious 'cause I can't see the hook into my C# code?
maybe I was descibing it badly
What I mean by call into my portal is to call into my C# code, call a function of some sort in my code.
The example edits the HTML code of the 3 portal components it doesn't seem to call into the C# code at all.
The search box component raises an event from script in the HTML
the other 2 catch that event also through script in HTML
at no point do they call into the underlying portal components code
Vin
Hello,
Is there a good way or example on how to pass the event message from the "EPCM.subscribeEvent" to the code-behind of a portal component while doing a postback?
I'm trying to accomplish something functionally equivalent to asp.net:
Response.Redirect("PortalComponent_equiv.aspx?m=message");
Thanks.
Hi,
Great question! since I know a good answer....
I recommend that you put 2 hidden controls on the page where you want to get the event: a button and a input field.
in the EPCM event handler script function put the param in the input field and then call a the button's click. In the server code (the button action event handler) you can access the inputfield.
Here is the script example:
<script language="javascript">
EPCM.subscribeEvent("urn:SAP.PDK.Samples.Search", "xSearch", searchFunction);
function searchFunction(eventObj)
{
var custName = eventObj.dataObject;
<%= Form.ID + "." + txtCustName.ClientID %>.value =custName;
<%= btnSubmit.ClientID %>.click();
}
</script>
Good luck,
Ofer
P.S: Please next time post new questions in new threads (makes it easier for others to search)
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.