我正在使用Knockout.js将列表绑定到表中。在此,为了排序和分页,我使用了数据表。在第一页,数据绑定工作正常。但是如果我移动到第二页,它就不工作了。如果有人能帮助我,那就太好了。我是Knockout.js的新手。下面是我的代码
<table id="datatable" class="table table-bordered thumbnail-table ">
<thead>
<tr>
<th width="8%"> Pip Code</th>
<th width="30%">Full Description </th>
<th width="20%">Product Description </th>
<th width="5%">Size</th>
<th width="5%">Quantity</th>
<th width="10%"> Manufacturer </th>
<th width="10%">Brand Name</th>
<th width="5%"><input type="checkbox" data-bind="checked: selectAll" /></th>
<th width="10%">Stock</th>
</tr>
</thead>
<tbody data-bind="dataTablesForEach : {data: items,
options: {
paging: true,
}}">
<tr data-bind="click: $root.selectRow">
<td data-bind="text:$data.pipCode"></td>
<td data-bind="text:$data.fullDescription"></td>
<td data-bind="text:$data.productDescription"></td>
<td data-bind="text:$data.size"></td>
<td data-bind="text:$data.quantity"></td>
<td data-bind="text:$data.manufacturer"></td>
<td data-bind="text:$data.brandName"></td>
<td><input type="checkbox" data-bind="checked:$data.include,click: function(){return true}, clickBubble: false" /></td>
<td><input type="text" style="width:50px" class="form-control" data-bind="value:$data.stock,click: function(){return true}, clickBubble: false" /></td>
</tr>
</tbody>
</table>
1条答案
按热度按时间jjhzyzn01#
我知道这个问题是不久前发布的,但是对于其他发现这个问题的人,您应该查看this article tl; dr KnockoutJS无法绑定到被DataTables分页隐藏的HTML元素