如何在剑道UI中从dataSource中获取特定的字段值

How can get certain field value from dataSource in kendo UI

本文关键字:获取 字段 dataSource 中从 UI      更新时间:2023-09-26

我定义了这样的数据源:

var dataSource = new kendo.data.DataSource({
  data: [
    {Id: 1, name: "Jane Doe", description: "some description", numberValue: "3000.00" },
    {Id: 2, name: "John Connor", description: "description temp", numberValue: "1800.00" },
    {Id: 3, name: "T-100", description: "descr tmp", numberValue: "2200.00"}
  ],
  schema: {
        model: {
            id: "Id",
            fields: {
                Id: { type: "number" },
                name: { type: "string" },
                description: { type: "string" },
                numberValue: { type: "number" }
            }
        }
    }
});

如何从dataSource获取特定字段值?例如:我想要获取字段numberValue的值(其中Id=1,或Id=2或Id=3)。如果我调用dataSource.data.numberValue,则不会发生任何事情。非常感谢您的帮助。提前谢谢。

dataSource.data显然是一个数组。