我正在尝试使用Jquery模式对话框将值传递给控制器来执行UPDATE函数。但是,我在HTML表格框中显示我的值,有没有办法将值从表格行传递到模态框?我想以某种方式执行此操作,当我单击该行时,值将显示在模态中。我也不确定如何将jquery对话框链接到表格行。
这是表格
这些是它的代码
<form id="searchtable" >
<%--List Table--%>
<table border = 1 cellpadding = 2 cellspacing = 2 id="normal">
<tr>
<th width=9.7%>ID</th>
<th width=24%>Username</th>
<th width=13%>Account ID</th>
<th width=29%>Email</th>
<th width=10%>User ID</th>
<th width=12%>Device ID</th>
</tr>
</table>
<div style="height: 250px; overflow: scroll; width: 100%;">
<table id="normal">
<g:each in = "${result}">
<tr>
<td width=10%>${it.ID}</td>
<td width=25%>${it.Username}</td>
<td width=13.5%>${it.account_id}</td>
<td width=30.5%>${it.email}</td>
<td width=10.5%>${it.user_id}</td>
<td width=13%>${it.device_id }</td>
</tr>
</g:each>
</table>
</div>
</form>
这是一个如何出现的对话框的例子
非常感谢你们。如果需要,我可以为你们提供代码。
答案 0 :(得分:1)
将.btn类用于您的tr并将您的用户名值包含在
中<span class="username">${it.username}</span>
你的jquery应该
$(document).ready(function() {
$(".btn tr").live("click", function{
var name = $(this).find(".username").text();
...put your code here that will update your table...
});
});
如果单击tr,它将找到具有“username”类的子项,并将为您获取数据。