如何使用 Dojo 的 ItemFileReadStore 中项目以外的数据对象?
我正在学习如何使用 Dojo 来使用 Web 服务。以下 JSON 是从 Web 服务返回的。我想通过 ItemFileReadStore 来处理它,但从我到目前为止的尝试来看,ItemFileReadStore 仅在 keywordsstat 术语更改为 items 时才有效。有没有办法告诉 ItemFileReadStore 使用 keywordsstat,或者它必须是项目?似乎另一种选择是编写一个自定义存储,但当 ItemFileReadStore 如此接近时,这似乎有点矫枉过正。
{
"keywordstat": [{
"word": "Apple",
"count": "1"
}, "word": "It's", "count": "1"
},
{
"word": "The",
"count": "3"
},
{
"word": "We've",
"count": "1"
},
{
"word": "amazing",
"count": "1"
}]
}
I am learning how to work with webservices using Dojo. The following JSON is returned from a webservice. I would like to handle it via an ItemFileReadStore, but from what I have tried so far the ItemFileReadStore only works if the keywordstat term is changed to items. Is there a way to tell ItemFileReadStore to work with keywordstat, or does it have to be items? It seems the other alternative is to write a custom store but that seems like overkill when ItemFileReadStore is so close.
{
"keywordstat": [{
"word": "Apple",
"count": "1"
}, "word": "It's", "count": "1"
},
{
"word": "The",
"count": "3"
},
{
"word": "We've",
"count": "1"
},
{
"word": "amazing",
"count": "1"
}]
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
事实证明,创建一个新的 ReadStore 非常简单。 问题已解决来创建 KeywordStatReadStore
我通过复制现有的 ItemFileReadStore 并更改为
。
Turns out its absurdly simple to make a new ReadStore. I created a KeywordStatReadStore by copying the existing ItemFileReadStore and changing
to
Problem solved.