开发者

How do I retrieve Extjs ArrayStore data?

I tried to find the answer a lot but no way. I have an Ext.data.ArrayStore store and want to get its data as string. I tried store.getRange(), store.getAt() but I couldn't figure out what these functions return. Is there any way to get ArrayStore data as string?

I am newbie to extjs, so if you have any example 开发者_Go百科on this, I'd appreciate.


It really depends what you want to do with the data. For most UI widgets and that sort of thing, you'll want to just use the store directly. If you want to get a piece of data from the store for tweaking manually, that's a whole nother story.

store.getRange() will indeed return all of the records from the store, but they are returned as an Array of Record objects. Records contain an attribute called data which is an object containing any properties you defined in the record's config.

Example:

Ext.each(store.getRange(), function (item, idx, a) {
  for (var i in item.data) {
    console.log(item.data[i])
  }
})

That should show you every item in every Record in store

EDIT: Changed my answer to not be totally wrong.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜