cancel
Showing results for 
Search instead for 
Did you mean: 

Getting selected row from a table using javaScript

Former Member
0 Kudos

Hello I tried to implement an onClientRowSelection event on my TableView. But until now the javaScript is not even called. I need to get the selected Row from my TableView.

This is what I wrote until now:

The javaScript:

<script language="javascript" type="text/javascript">

function tableSelect(){

alert('abcdef');

}

</script>

The jsp:

table.setOnClientRowSelection("tableSelect");

Thanks for any suggestions.

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks for your suggestions but the error was neither the functionheader in the JavaScript nor a missing page tag.

You only have to set the complete function call into the onClientRowSelection attribute. e.g.:

table.setOnClientRowSelection("tableSelect(htmlbevent)");

With this functionality you have got more options for your JavaScript call, but the use is absolutely inconsistend to the normal Java function calls.

Former Member
0 Kudos

Still u dont have the answer to the question ?

If yes i can help you, as i have done this

Former Member
0 Kudos

Hello,

Indeed a very intresting issue. I have the same issue. I get now into the event, but how do I get the rownumber out?

Thank you for helping me out

Koen Van Loocke

Former Member
0 Kudos

Hi,

just found it:

function tableSelect(myEvent){

alert(myEvent.obj.clickedRow.toString());

}

Koen

Former Member
0 Kudos

No, even with the parameter it doesn't work.

Former Member
0 Kudos

From the htmlb documentation

If JavaScripts are used (for 'onClientClick' events) the page tag is necessary for the renderer to place the JavaScripts at the end of the page.

<hbj:content id="myContent">

<hbj:page title="sap">

...

</hbj:page>

</hbj:content>

Could this be the problem (no page element) ?

Former Member
0 Kudos

I belive the javascript method should have a parameter.

Try

<script language="javascript" type="text/javascript">

function tableSelect(htmlbEvent){

alert('abcdef');

}

</script>