正在为嵌套列表设置LocalStorage存储
Setting LocalStorage store for nested list
我已经创建了一个本地存储库,并按照本教程将演示值存储在其中:
http://sureshdotariya.blogspot.com/2013/03/understanding-local-storage-proxy-in.html
这一切都很好,我在chrome中查看了资源中的存储数据,它就在那里,当我加载页面时,它加载得很好,没有错误,但没有显示任何数据,这是我的视图代码:
Ext.define('MyTest.view.SearchPanel', {
extend: 'Ext.Panel',
xtype: 'searchpanel',
config: {
layout: 'fit',
items: [
{
xtype: 'nestedlist',
title: 'Search Results',
displayField: 'Name',
store: {
storeId: 'UserStore',
fields: ['Name']
},
}]
}
});
我在这里错过了什么?我可以使用本地存储存储作为嵌套列表的存储吗?如果是的话,那么为什么它显示"没有找到项目",我在app.js中添加了商店,我试着在这个视图中要求它,但没有成功。
谢谢你的帮助。
Ext.dataview.NestedList需要Ext.data.TreeStore而不是Ext.data.Store(在您提供的示例URL中(。
Ext.data.TreeStore中需要root
、defaultRootProperty
配置,项中有leaf
属性。
当然,您可以在Ext.data.TreeStore中将Ext.data.proxy.LocalStorage设置为代理,请尝试使用以下代码:
Ext.define('ListApp.model.User', {
extend: 'Ext.data.Model',
config: {
fields: [{
name: 'text',
type: 'string'
}]
}
});
Ext.define('App.store.User', {
config: {
model: 'ListApp.model.User',
defaultRootProperty: 'items',
root: data
proxy: {
type: 'localstorage',
id: 'UserInfo'
}
}
});
相关文章:
- 如何将localStorage值设置为false
- 将localStorage字符串设置为Integer
- 将图像加载到localStorage,并将图像src设置到该位置
- 在设置标头之前清空localStorage
- 无法在 Backbone.localStorage 插件中设置初始收集数据
- 是否可以在localStorage中设置不可修改(常量)项?如果是,如何
- 为表中要存储在localStorage中的选定行设置唯一ID
- 获取/设置数值到localstorage
- 检测浏览器是否允许设置localStorage.setItem();
- 如果没有返回,我如何将localStorage值设置为数字1
- 正在为嵌套列表设置LocalStorage存储
- 在我启动我的selenium脚本之前,如何在浏览器的localStorage中使用ruby设置item
- iOS上的LocalStorage配额超过(dom error 22),但未设置私有模式
- 从inAppBrowser设置的localStorage值没有在外部显示- cordova
- 设置空localStorage对象会导致“[object object]”
- 设置localStorage保存的频率
- JQuery检查是否设置了localStorage
- 如何根据localStorage中是否有条目来设置对象中的值?
- 如何将localstorage项设置回null
- 使用复选框和angular为localStorage设置true/false值