如何为数据表中的记录分配超链接 [英] How to assign hyperlink to records in datatable

查看:85
本文介绍了如何为数据表中的记录分配超链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是JQuery的新手。我正在尝试创建一个DataTable。所有功能都很有效。但是在DataTable记录中,第一列是userid,比如1,2,3等,它们是用户配置文件页面的超链接。即当点击1时,它将调用/userprofile.jsp?id=1 ..我不知道如何进行这些更改。非常感谢。

I am new to JQuery. I am trying to create a DataTable. All the functionality works very well. But in DataTable records first column is userid, say 1,2,3 etc which are hyperlink to user profile page. i.e. when click on 1, it will call /userprofile.jsp?id=1 ..I don't know how to make these changes.Any help appreciated.

推荐答案

我从未使用过jsp。但是这里有一个想法。

根据您的描述,您在第一列绑定 1 。而是在那里用URL创建一个超链接。



之前

I never worked with jsp. But here an idea.
Based on your description, you're binding 1 on first column. Instead create a hyperlink there with URL.

Before
<td>1</td>



之后


After

<td><a href="/userprofile.jsp?id=<b>1</b>">1</a></td>



创建ID值为&的动态网址将该超链接放在第一列。


Create dynamic URL with ID value & put that hyperlink in first column.


fnRender函数有助于使用其他列的值创建链接。您可以使用oObj.aData获取另一列的值,如id,以生成链接。



The fnRender function helps to create the links using the values of the other columns. You can use the oObj.aData to get the values of the other column like id to generate the links.


document )。ready( function (){
(document).ready(function () {


这篇关于如何为数据表中的记录分配超链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆