我有一個參數模板是這樣的:獲取模板的參數在播放框架
@(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