Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Pass tableView cell value into Javascript

Hi, BSP gurus,

I'm stuck now and really need your help. What I'm trying to do is to retrieve a cell value from a selected tableView column, and then pass the value to a JavaScript function (GetGraphic(e0)). The JS calls another controller (c_map_track.do) and launch a new window. Everything else works fine except that the line "document.getElementByName(MATNR)" doesn't work. Do you have any idea what's the correct command to get the cell value? Any hints will be greatly appreciated and rewarded with points. Here is my code.

Javascript:

function GetGraphic(e0) {

var var0 = e0.value;

var WFeatures='top=200, left=450, width=550, height=550, resizable=yes, scrollbars=yes';

var nextpageurl = "c_map_track.do?lv_material=" + var0;

Results = new Array();

Results = window.open(nextpageurl, "", WFeatures);

}

.....

View:

<htmlb:tableViewColumns>

<htmlb:tableViewColumn columnName = "GRAPHICS"

tooltipColumnKey = "<%= otr(zsrm/graphics) %>"

type = "user"

title = "<%= otr(zsrm/graphics) %>"

horizontalAlignment = "CENTER" >

<htmlb:image src = "<%= CL_BSP_MIMES=>SAP_ICON( id = '@B_GRAF@' ) %>"

id = "$MATNR$"

onClientClick = "GetGraphic(document.getElementByName(MATNR))" />

</htmlb:tableViewColumn>

<htmlb:tableViewColumn columnName = "MATNR"

tooltipColumnKey = "<%= otr(zsrm/material) %>"

title = "<%= otr(zsrm/material) %>"

sort = "server"

horizontalAlignment = "LEFT" >

</htmlb:tableViewColumn>

...

</htmlb:tableView>

replied

In the view you shd have something like below:

    <htmlb:tableView id               = "tv"
                     headerText       = "Title"
                     width            = "100"
                     headerVisible    = "true"
                     design           = "alternating"
                     visibleRowCount  = "8"
                     fillUpEmptyRows  = "true"
                     showNoMatchText  = "true"
                     filter           = "server"
                     sort             = "server"
                     onRowSelection   = "MyEventRowSelection"
                     selectionMode    = "SINGLESELECT"
                     selectedRowIndex = "<%=selectedRow %>"
                     table            = "<%= your_table %>"
                     iterator         = "<%=your_iterator %>" />

Raja T

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question