使用 knockoutjs 绑定数据表时无法处理绑定

Unable to process binding when binding datatables with knockoutjs

我正在尝试将 jquery 数据表与 knockoutjs 一起使用。数据表网格呈现良好,但在浏览器控制台中看到错误 window。有人可以帮我解决这个问题,如果我做错了什么可以纠正我吗?

http://jsfiddle.net/5hwg1p36/

**Error:**
knockout-min.js:73 Uncaught TypeError: Unable to process binding "dataTable: function(){return { deferRender:true,scrollY:'200',scrollX:true,paging:true,select:Select,dom:'t,p',columns:Columns,columnDefs:ColumnDefinitions,data:Data,pagingType:'full'} }"
Message: Cannot read property 'replace' of null
    at Jb (jquery.dataTables.min.js:68)
    at jQuery.fn.init.<anonymous> (jquery.dataTables.min.js:91)
    at jquery.dataTables.min.js:76
    at Function.map (jquery-3.3.1.js:443)
    at r (jquery.dataTables.min.js:76)
    at P (jquery.dataTables.min.js:31)
    at T (jquery.dataTables.min.js:31)
    at ha (jquery.dataTables.min.js:48)
    at e (jquery.dataTables.min.js:93)
    at HTMLTableElement.<anonymous> (jquery.dataTables.min.js:93)

[JS Fiddle for this issue is here: ][1]


  [1]: http://jsfiddle.net/5hwg1p36/

错误发生是因为您试图添加一个 title 属性 为 null 的新列。 jQuery DataTables 要求 属性 为 not null

修复非常简单,只需将 title: null 更改为 title: ""。在您的 fiddle 中,它在线 35

self.Columns.push({
    data: null, 
    title: "", // this property cannot be null, so use empty string instead
    searchable: false, 
    visible: true, 
    orderable: false, 
    defaultContent: ''
});

工作fiddle:http://jsfiddle.net/5hwg1p36/1/