【发布时间】:2015-03-19 02:14:46
【问题描述】:
我创建了一个包含两列的 Kendo UI 网格。 一个只是一个名为 num0 的数字。 另一个称为 num1,它的数据是从 num0 到 a 模板。
num0 上的过滤器可以找到。 num1 上的过滤器出现,您可以使用它,但是 找不到匹配项。即:过滤num1并选择“等于”并输入“2”, 然后点击“过滤器” 并且当它应该显示第一条记录时,网格被清空。
另外,我使 num0 列可编辑,而 num1 列不可编辑。 如果 num0 被编辑,我想改变 num1 列。
我认为这与我使用的“模板”有关 填充 num1 列。
我需要做些什么来解决这个问题,以便过滤器正常工作?
谢谢
http://jsfiddle.net/elbarto99/acyxekgx/
$(document).ready(function()
{
// Define the datasource for the grid.
var dsNums = new kendo.data.DataSource({
// NOTE: I don't want a num1: data field set to static values.
// I would like one that is set from "num0 + 1" and when num0 data is edited
// num1 would be updated to "num0 + 1"
data: [
{ num0: 1 },
{ num0: 2 },
{ num0: 3 },
{ num0: 4 },
],
schema:
{
model:
{
id: "myGridID",
fields:
{
num0: { type: "number" },
num1: { type: "number", editable: false },
}
}
}
});
// Create the grid.
var _grid = $("#grid").kendoGrid({
dataSource: dsNums,
filterable: { extra: false },
editable: true,
columns: [
{ field: "num0" , title: "Num 0" , width: "90px", },
// Add 1 to num0 and display in num1 column
// Note: A filter shows up and is for numbers but doesn't work
// I think it doesn't work because I am using a template.
//
// What do I need to do to make the filter for column num1 work like it does for num0?
{ field: "num1" , title: "Num 1 - Filter shows up but doesn't find matchs. :-(" , width: "90px", template: "#= num0 + 1 #", },
],
}).data("kendoGrid");
});
【问题讨论】:
标签: kendo-ui kendo-grid kendo-datasource