0
我想建立一個表使用Icanhazjs(鬍子)動態表。表格數據總是在表格標籤之外呈現,因此不會將數據放入表格中。麻煩與動態HTML表與鬍鬚&Icanhazjs
你可以看到在我的jsfiddle輸出Here
這裏是我的HTML:
<script id="display_row" type="text/html">
<tr>
<td>{{data1}}</td>
<td>{{data2}}</td>
<td>{{data3}}</td>
</tr>
</script>
<h1>Icanhazjs & Mustache Table Test</h1>
<table border="1">
<thead>
<tr>
<th>Header 1</th>
<th>Header 2</th>
<th>Header 3</th>
</tr>
</thead>
<tbody>
<div id="table_list"></div>
</tbody>
</table>
這裏是JavaScript:
$(document).ready(function() {
var user_data, user;
user_data = [
{
data1: "foo1",
data2: "foo2",
data3: "foo3"
},
{
data1: "foo4",
data2: "foo5",
data3: "foo6"
}
];
for (i=0; i<user_data.length; i++) {
user = ich.display_row(user_data[i]);
$('#table_list').append(user);
}
});
任何人能解釋爲什麼數據不在我的html表格<div id="table_list"></div>
處呈現。 icanhazjs正在工作,但只是將呈現的html放在我的表之前。
你是真棒!我太親近了:)謝謝。 – 2013-03-01 22:26:02
@fatfantasma:不要忘記標記我的答案是正確的。 Upvoting的答案將很好,以及:) – 2013-05-21 16:29:04