extjs 数组读取器

发布于 2024-10-08 16:43:15 字数 83 浏览 0 评论 0原文

我正在尝试使用数组读取器创建数据存储。在每条记录中,都有一个字段数组。但是,我只需要记录中的一些字段。如何设置数组读取器以便只有部分记录映射到数据存储?

I'm trying to create a data store with an array reader. in each of the record, there is an array of fields. However, I only need some of the fields in the record. How can I setup the array reader so that only part of the record is mapped to the data store?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

就是爱搞怪 2024-10-15 16:43:15

对于读取器中的每个字段,只需添加一个“映射”项并将其设置为等于该项在数组中的索引。例如:

var arrData = [
    ['Col 1', 'Col 2', 'Col 3']
    ['Col 1', 'Col 2', 'Col 3']
    ['Col 1', 'Col 2', 'Col 3']
];
var reader = new Ext.data.ArrayReader({}, [
    {name: 'First Column', mapping: 0},
    {name: 'Third Column', mapping: 2},
]);

这将排除第二列(从零开始的索引)

For each field in the reader, just add a 'mapping' item and set it equal to the index of the item in the array it is for. eg:

var arrData = [
    ['Col 1', 'Col 2', 'Col 3']
    ['Col 1', 'Col 2', 'Col 3']
    ['Col 1', 'Col 2', 'Col 3']
];
var reader = new Ext.data.ArrayReader({}, [
    {name: 'First Column', mapping: 0},
    {name: 'Third Column', mapping: 2},
]);

This will exclude the 2nd column (zero based index)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文