我下载了jQuery表,但我不能使用。我将JS文件添加到我的页面中:
<script src="../assets/jquery-tabledit-1.2.3/jquery.tabledit.js"></script>
<script src="../assets/jquery-tabledit-1.2.3/jquery.tabledit.min.js"></script>
<script>
$('#sales_table').Tabledit({
url: 'example.php',
editButton: false,
deleteButton: false,
hideIdentifier: true,
columns: {
identifier: [0, 'id'],
editable: [[2, 'firstname'], [3, 'lastname']]
}
});
</script>这是我的桌子
<table id="sales_table" border="1">
<tr>
<td id="firstname" name="firstname">a</td>
<td>a</td>
</tr>
</table>但是什么都没发生,也不能编辑表格。任何帮助都是非常感谢的。
发布于 2016-01-09 17:18:28
您对可编辑列使用了错误的索引值,还需要一个标识符列。对Tableedit的调用隐藏了标识符列。
您似乎也没有引用主要的jquery库(至少在您提供的示例中):JQuery
有关工作示例,请参见此:小提琴
如果要更新表并执行任何其他功能,则需要阅读文档:
<table id="sales_table" border="1">
<thead>
<tr>
<td>First name</td>
</tr>
</thead>
<tbody>
<tr>
<td id="identifier" name="identifier">1</td>
<td id="firstname" name="firstname">John</td>
</tr>
</tbody>
</table>JQuery
$('#sales_table').Tabledit({
url: 'example.php',
editButton: false,
deleteButton: false,
hideIdentifier: true,
columns: {
identifier: [0, 'id'],
//Note that I've modified the column index values.
editable: [[1, 'firstname'], [2, 'lastname']]
}
});https://stackoverflow.com/questions/34695512
复制相似问题