cancel
Showing results for 
Search instead for 
Did you mean: 

htmlb:tableViewColumn and JavaScript Link

Former Member
0 Kudos

Hi All,

I'm developing an HTMLB table the first column of which is supposed to be a hyperlink with custom javascript. In other words, when I click on the hyperlink, it's supposed to launch the custom javascript, thus opening a new browser window. This would be similar to the onClientClick property of regular HTMLB links where you can call a custom JS function.

Do you know how this can be accomplished within HTMLB table? Here is my code sample:


<htmlb:tableView id="list"
table="<%=list%>"
encode='TRUE'
headerVisible='FALSE'
design='STANDARD'
footerVisible='<%=listinc_footerVisible%>'
visibleRowCount='<%=listinc_visibleRowCount%>'
rowCount='<%=listinc_lines%>'
width='<%=width%>'
sort          = "SERVER"
keyColumn     = "ID"
>
<htmlb:tableViewColumns>
<htmlb:tableViewColumn columnName  = "ID"
                       title       = "<%=model->get_textpool_text( 'I28' )%>"
                       encode      = "TRUE"
                       wrapping    = "FALSE"
                       sort        = "TRUE"
                       preSelectedSortDirection = "DESCENDING"
                       type        = 'Link'
                       linkColumnKey   = "tableviewlink"
                       linkClickTarget = "_servicerequest3"
                       >
</htmlb:tableViewColumn>
<htmlb:tableViewColumn columnName  = "SHORTTEXT"
                       title       = "<%=model->get_textpool_text( 'I22' )%>"
                       wrapping    = "TRUE"
                       sort        = "TRUE"
                       >
</htmlb:tableViewColumn>
<htmlb:tableViewColumn columnName  = "RQDAT00"
                       title       = "<%=model->get_textpool_text( 'I52' )%>"
                       wrapping    = "TRUE"
                       sort        = "TRUE"
                       >
</htmlb:tableViewColumn>
</htmlb:tableViewColumns>
</htmlb:tableView>

The first column "ID" is from where the custom JS is supposed to be launched.

Thanks!

Roman D.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

You can use the following code sample:

[code]

<htmlb:tableViewColumn columnName "ID"

title = "<%=model->get_textpool_text( 'I28' )%>"

encode = "TRUE"

wrapping = "FALSE"

sort = "TRUE"

preSelectedSortDirection = "DESCENDING"

type = "<b>USER</b>"

>

<htmlb:link id = "mylinkid"

onClientClick = "fnFunction();"

text = "$ID$"/>

</htmlb:tableViewColumn>[/code]

"$ID$" can only be used with design2002.

I hope it helps.

Regards,

Rohit

Answers (1)

Answers (1)

Former Member
0 Kudos

hi,

do it like this for your first column.

<htmlb:tableViewColumns>

<htmlb:tableViewColumn

columnName = "ID"

title = "<%=model->get_textpool_text( 'I28' )%>" type = 'USER'

>

<htmlb:link id = "ID"

onClientClick = "your_JS"

text = "your_link_text" >

</htmlb:link>

</htmlb:tableViewColumn>

remember this will launch same javascript for each row.

if you want to change dynamically for every row then you have to use tableviewiterator to render every row. and change JS accordingly for each row.

check out weblog for tableview iterator

/people/brian.mckellar/blog/2003/10/31/bsp-programming-htmlb-tableview-iterator

regards.