繁体   English   中英

数据绑定在使用数据表分页的knockout.js 中不起作用

[英]Data-Binding not working in knockout.js using datatable pagination

我正在使用 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>

我知道这个问题是不久前发布的,但是对于发现这个问题的其他人,您应该查看这篇文章tl; Dr KnockoutJS can't bind to HTML elements hidden by DataTables Pagination

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM