我为jquery尝试了Tabledit插件。它工作正常。但是,如果我想将编辑字段作为选择字段,则它不起作用。编辑字段也显示为文本输入字段,而不是选择字段。我做错了什么。
$('#mytable').Tabledit({
columns: {
identifier: [0, "id"],
editable: [
[1, 'car'],
[2, 'color', '{"1": "red", "2": "green"}']
]
}
});
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/jquery-tabledit@1.0.0/jquery.tabledit.min.js"></script>
<table id="mytable">
<thead>
<tr>
<th>id</th>
<th>Car</th>
<th>Color</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>Ferrari</td>
<td>Red</td>
</tr>
<tr>
<td>2</td>
<td>Lotus</td>
<td>Green</td>
</tr>
</tbody>
</table>