@{
Layout = "~/Views/Company/JQueryDataTableEditableLayout.cshtml";
}
@section head{
<script language="javascript" type="text/javascript">
$(document).ready(function () {
$('#myDataTable').dataTable().makeEditable({
"aoColumns": [
null,
null, {
tooltip: 'Double-Click'
}, {
tooltip: 'Double-Click to select Code'
}]
});
$('#myDataTable tbody td button').live('click', function () {
var nTr = $(this).parents('tr')[0];
$(myDataTable).dataTable().fnAddData(["test", "test1", "test2", "test3"]);
});
});
</script>
}
<div id="demo">
<h1>Basic Example</h1>
<table id="myDataTable" class="display">
<thead>
<tr>
<th>Company name</th>
<th>Address</th>
<th>Town</th>
<th></th>
</tr>
</thead>
<tbody>
@{
foreach (var item in Model)
{
<tr>
<td>@item.Name</td>
<td>@item.Address</td>
<td>@item.Town</td>
<td> <button id= "@item.ID" name="Split" >SplitLine</button></td>
</tr>
}
}
</tbody>
</table>
</div>
我正在使用可编辑的数据表,我想在父行下方添加一个新的可编辑行。
这是我到目前为止的代码,它在最后添加了新行。