我有一个参数模板是这样的:获取模板的参数在播放框架
@(people: List[models.Person])
<html>
<head>
</head>
<body>
<table class="centered" id="table_people">
<thead>
<tr class="table_header">
<th></th>
<th class="people_column">Name</th>
<th class="people_column">Active</th>
</tr>
</thead>
<tbody>
@for(p <- people) {
<tr>
<td><button id="timesheet_view_" >View</button</td>
<td><b>@p.getName()</b></td>
<td>@p.isActive()</td>
</tr>
}
</tbody>
</table>
该代码显示的人的名单。现在,我想单击按钮视图时,它会显示人的信息。要做到这一点,我必须写这样的事情:
<script>
$("#timesheet_view_<%= people[i].id %>")
.button()
.click(function() {
people = '<%= people[i].name %>';
showTimeSheet('current', '<%= people[i].name %>');
})
</script>
但我找不到如何在Javascript中获取模板的价值人参数。我尝试使用@字符,但它不起作用。
我不认为你的答案是正确的,人们参数未利用的脚本标记。 – Riddle 2014-02-21 15:05:38