无法将 jQuery table编辑器附加到我的 table
can't attach jQuery tableditor into my table
我下载了 jQuery tableditor 但我不能使用。
我在页面中添加了 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:
<table id="sales_table" border="1">
<tr>
<td id="firstname" name="firstname">a</td>
<td>a</td>
</tr>
</table>
但什么也没发生,无法编辑table。
感谢任何帮助。
您为 editable 列使用了错误的索引值,您还需要一个标识符列。通过调用 Tableedit
.
隐藏标识符列
您似乎也没有引用主 jquery 库(至少在您提供的示例中):
JQuery
有关工作示例,请参见:
Fiddle
如果您想更新 table 并执行任何其他功能,您需要阅读文档:
Html
<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']]
}
});
我下载了 jQuery tableditor 但我不能使用。 我在页面中添加了 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:
<table id="sales_table" border="1">
<tr>
<td id="firstname" name="firstname">a</td>
<td>a</td>
</tr>
</table>
但什么也没发生,无法编辑table。 感谢任何帮助。
您为 editable 列使用了错误的索引值,您还需要一个标识符列。通过调用 Tableedit
.
您似乎也没有引用主 jquery 库(至少在您提供的示例中): JQuery
有关工作示例,请参见: Fiddle
如果您想更新 table 并执行任何其他功能,您需要阅读文档:
Html
<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']]
}
});