Javascript 从格式化程序在表中添加复选框
我用这个代码创建我的表Javascript 从格式化程序在表中添加复选框,javascript,html,jquery,html-table,datatable,Javascript,Html,Jquery,Html Table,Datatable,我用这个代码创建我的表 <table class="table table-striped table-bordered dataTable" id="tabela-agencias" style="margin: 30px 0px 65px;"> <thead> <tr> <th data-column-id="aa">@Html.LabelF
<table class="table table-striped table-bordered dataTable" id="tabela-agencias" style="margin: 30px 0px 65px;">
<thead>
<tr>
<th data-column-id="aa">@Html.LabelFor(model => model.First().aa)</th>
<th data-column-id="Name">@Html.LabelFor(model => model.First().Name)</th>
<th data-column-id="Name">@Html.LabelFor(model => model..First().NameLast)</th>
<th data-column-id="ccc">@Html.LabelFor(model => model.First().ccc)</th>
<th data-column-id="ddd">@Html.LabelFor(model => model.First().ddd).ToString().Replace(",", ".")</th>
<th data-column-id="bbb">@Html.LabelFor(model => model.First().bbb).ToString().Replace(",", ".")</th>
<th data-column-id="CreatedDate">@Html.LabelFor(model => model.First().CreatedDate)</th>
<th data-column-id="Status">@Html.LabelFor(model => model.First().Status)</th>
<th data-column-id="CheckBox"></th>
<th data-formatter="Details"></th>
</tr>
</thead>
<tbody></tbody>
</table>
@LabelFor(model=>model.First().aa)
@Html.LabelFor(model=>model.First().Name)
@LabelFor(model=>model..First().NameLast)
@LabelFor(model=>model.First().ccc)
@Html.LabelFor(model=>model.First().ddd).ToString().Replace(“,”,”)
@Html.LabelFor(model=>model.First().bbb.ToString().Replace(“,”,”)
@LabelFor(model=>model.First().CreatedDate)
@LabelFor(model=>model.First().Status)
我不知道如何在复选框列中添加复选框,我尝试了以下方法:
<script>
var delegate = function (request) { request.Name = $("#Name").val(); return request; };
var formatter = {
"Details": function (column, row) {
return '<a href="/xxxxx/ccccc/vvvvvvv/?Id=' + row.Id + ' ">Detalhes</a>';
},
"CheckBox": function (column, row) {
return "<td> "+
"<input type='checkbox' id='check1' name='a1' value='false'/> " +
"</td>";
}
};
_applyPagination(".table", delegate, "/zzzzzz/oooooooo/xxxxxxxResults", formatter, "#btnSearch", "#resetSearch");
var delegate=function(request){request.Name=$(“#Name”).val();return request;};
变量格式化程序={
“详细信息”:功能(列、行){
返回“”;
},
“复选框”:函数(列、行){
返回“”+
" " +
"";
}
};
_applyPagination(“.table”,delegate,/zzzzzz/ooooooo/xxxxxxx结果),格式化程序,“#btnSearch”,“#resetSearch”);
但结果是一列文字为“True”。
有人能帮我吗