|
本帖最后由 ivyaiivy 于 2017-11-30 16:21 编辑
添加列,代码如下:- var parentNode = this.getElementByXid("tableDiv");
- // var parentNode = this.getElementsByXid('tableDiv');//切记,这个是根据xid获取Element列表
- var jsonArry = [];
- var jsonObj;
- //var initdate = "2017-11-20";
- var date = new Date();
- var dates = date.getDate();
- for (var int = 20; int < dates; int++) {
- jsonObj={"sName":int,"xid":int,"sTitle":int};
- jsonArry.push(jsonObj);
- }
-
- debugger;
- var option = {
- parentNode : parentNode,
- //dataTables的属性,设计时有的属性都可以设置
- xid: "cTable",
- data : "createTableData",
- class:'table table-bordered table-hover table-striped',
- flexibleWidth : true,
- responsive : false,
- multiSelect: true,//多选框 属性,没有效果
- showRowNumber: true,
- ordering : true,
- // 列定义
- columns : jsonArry
- };
- var newTable = new dataTables(option);
- newTable.setCSS({"margin": "0px"});//设置CSS样式
- };
复制代码
浏览器报错如下:
core.min.js:71 Uncaught TypeError: Unable to process binding "component: function (){return {name:'$model/UI2/system/components/justep/dataTables/dataTables'} }"
Message: a.sTitle.replace is not a function
at nn (comp2.min.js:68)
at h.fn.init.<anonymous> (comp2.min.js:68)
at comp2.min.js:68
at Function.map (core.min.js:71)
at mn (comp2.min.js:68)
at ct (comp2.min.js:68)
at bt (comp2.min.js:68)
at comp2.min.js:68
at f (comp2.min.js:68)
at h.fn.init.fnServerData (comp2.min.js:68)
请问这是怎么回事呢。
|
|