gpt4 book ai didi

javascript - Kendo Grid 详细信息导致父网格刷新?

转载 作者:行者123 更新时间:2023-11-28 08:17:40 25 4
gpt4 key购买 nike

我不明白这里发生了什么。我正在尝试为网格创建自定义指令,并将使用元素属性来自定义给定的实例。为此,我创建了两个文件

grid-controller.js

app.controller('gridController', ['$scope', function ($scope ) {

//Initilization code

$scope.gridOptions = {
//Setup options
};

$scope.detailOptions = function (e) {
console.log('winning');
return {
dataSource: {
transport: {
read: {
url: "/detail" + e.OrderNumber + ".json",
dataType: 'json'
}
},
error: function (e) {
console.log(e);
},
pageSize: true,
serverPaging: false,
serverFiltering: false,
serverSorting: false,
},
columns: [
{
field: "ItemCode",
label: "lblItemCode",
title: ""
}, {
field: "ItemDesc",
label: "lblItemDesc",
title: ""
}, {
field: "QuantityOrdered",
label: "lblQuantityOrdered",
title: ""
}
],
scrollable: false,
sortable: true
};
}

}]);

grid-directive.js

app.directive('grid', function () {
return {
// Restrict E for element
restrict: 'E',
// Here we setup the template for the code we want to replace our directive
template: "<div> \n\
<div kendo-grid='grid' \n\
k-options='gridOptions'\n\
k-data-source='dataSource'>\n\
</div> \n\
<script type='text/x-kendo-template'\n\
id='details'>\n\
<div kendo-grid >\n\
</div>\n\
</script>\n\
</div>",
replace: true,
scope: {
},
controller: "gridController",
link: function (scope, element, attrs) {

//Gather some attribute data and set it to the gridOptions object


if(scope.$eval(attrs.detailsGrid))
{
scope.gridOptions.detailTemplate = kendo.template($("#details").html());
scope.gridOptions.detailInit = scope.detailOptions;
}

//More customization code

scope.dataSource = new kendo.data.DataSource({
//Setup dataSource options for main grid
});
}
};
});

为了简洁起见,我排除了很多额外的代码。

我的问题是,每当我尝试打开一行的详细信息时,该行就会打开...关闭...并且网格似乎会刷新。看起来几乎像是有什么东西崩溃了,结果主网格正在刷新。

这是关联的plunkr注释部分更加充实。

最佳答案

因此,在我发布问题的第二天,Angular-kendo 发布了 update解决了这个问题。更新库并修复我的代码后,详细信息网格按预期工作!

关于javascript - Kendo Grid 详细信息导致父网格刷新?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23415717/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com