grid.Destroy()在安装新的Kendo UI版本后无法正常工作,保存更改的数据也无法正常工作

时间:2014-08-22 23:12:05

标签: kendo-ui

我们一直在使用与angularJS集成的Kendo UI Grid,使用angular-kendo.js JavaScript库进行集成。

Kendo UI的新版本将角度指令与核心Kendo功能集成在一起,已经破坏了我们的应用程序。

grid.Destroy()函数删除除“数量”列之外的所有列,这些列是基于数组的JavaScript对象。

在grid.Destroy()之后的网格中留下的“数量”列是在运行时动态构造的,因为在从服务器返回数据之前我们不知道“数量”列的数量。

在初始页面加载时,所有网格数据都会正确显示。

以下是正在使用的代码。

 // one row of Jason sent from the server to populate the dataSource:


{"col1":[1,3],"col2":"12345","col3":[1,3],"col4":"Value","col5":1,"col6":"99999","col7":"324567-
29","col8":"22222","col9":"true","Quantities": 
[{"qty":"3",   "modified":"false","status":"A"},     
{"qty":"3",  "modified":"false","status":""},{"qty":"3", "modified":"false","status":""}, 
{"qty":"3","modified":"false", "status":""}]}



 //  Code to dynamically create Quantities columns

// dynamically create column headers for partQuantities


// loop through lomPartNumberColumnHears to get column titles


var abcQtyColumnHeader = function (field, title, width, attributes, template) {


this.field = field;


this.title = title;


this.width = width;


this.attributes = attributes;


this.template = template;


}




// get length of ABCColumnHeaders to establish loop for creating partQuantity
column headers


var abcLength = ourData.ABCColumnHeaders.length;




// loop to push partQuantities column header objects onto colDefinitionData
array


for (var i = 0; i < ourData.ABCColumnHeaders.length; i++) {


var title = ourData.ABCColumnHeaders[i];


var QuantityField = "Quantities[" + i + "].qty";


var width = "46px";          
var template = "<div value=#if(Quantities[" + i + "].status ==='A'){# #='add'# #} else if  
(Quantities[" + i + "].status === 'D'){##='delete'# #} else if(Quantities[" + i +"].status 
=== 'C'){##='change'# #}#>#= Quantities[" + i + "].qty #</div>";
var attributes = { style: "text-align:center" };
var abcQuantityColumnHeader = new abcQtyColumnHeader(partQuantityField, title,
width, attributes, template);
colDefinitionData.push(abcQuantityColumnHeader);
}

0 个答案:

没有答案