gpt4 book ai didi

javascript - Kendo UI 多个网格的一个数据源

转载 作者:行者123 更新时间:2023-11-30 06:36:34 27 4
gpt4 key购买 nike

我最近遇到 Kendo UI 问题,我有 1 个数据源,它被 3 个网格使用。这一切都有效,但由于某种原因,由于缺乏更好的词,网格的样式被“拆除”。

如果我从网格 A 中过滤数据源,网格 A 看起来不错,但网格 B 和 C 看起来像这样(不要介意列中的名字“Error”):

Grid B and C

如果我从网格 B 过滤数据源,网格 B 现在看起来不错,但网格 A 和 C 看起来“已拆除”。可能是什么问题?

网格 A:

    $('#grid-a').kendoGrid({
autoBind: false,
dataSource: emp_ds,
toolbar: kendo.template($("#mainlist-template").html()),
scrollable: true,
sortable: true,
selectable: 'row',
pageable: {
input: true,
},
columns: [{
field: "id",
title: "ID",
width: 100
},{
field: "firstname",
title: "Firstname"
},{
field: "lastname",
title: "Lastname"
}
]
});

网格 B:

    $('#grid-b').kendoGrid({
autoBind: false,
dataSource: emp_ds,
toolbar: kendo.template($("#emplist-template").html()),
scrollable: true,
sortable: true,
selectable: 'row',
pageable: {
input: true,
},
columns: [{
field: "id",
title: "ID",
width: 100
},{
field: "firstname",
title: "Firstname"
},{
field: "lastname",
title: "Lastname"
},{
command: {
text: 'Select',
click: function(e) {
e.preventDefault();

if(employeeSelectSwitch == 2) {
return;
}

varholder.curUid = $(e.currentTarget).closest("tr").data('uid');

$('#daterange-dialog').data('kendoWindow').center().open();
}
},
width: 140
}]
});

数据源:

emp_ds = new kendo.data.DataSource({
transport: {
read: {
dataType: 'json',
url: url.employeeList
}
},
schema: {
model: {
fields: {
id: { type: 'number' },
firstname: { type: 'string' },
lastname: { type: 'string' },
}
}
},
pageSize: 15
});

最佳答案

开玩笑为什么你需要 3 个网格来显示相同​​的数据,如果你不共享数据源,请使用 3 个数据源。故事看看@Kendo 共享数据源。

关于javascript - Kendo UI 多个网格的一个数据源,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14042958/

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