欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

extjs4.0  

程序员文章站 2022-05-24 09:38:23
...
icon is an option, but it's not in the default model of the TreeStore. Setup your model first and use it in your store.



Ext.define('Portal.model.Device', {
extend: 'Ext.data.Model',
fields: [
{name: 'text', type: 'string', defaultValue: null},
{name: 'parentId', type: 'string', defaultValue: null},
{name: 'index', type: 'int', defaultValue: null},
{name: 'depth', type: 'int', defaultValue: 0},
{name: 'expanded', type: 'bool', defaultValue: false, persist: false},
{name: 'expandable', type: 'bool', defaultValue: true, persist: false},
{name: 'checked', type: 'auto', defaultValue: null},
{name: 'leaf', type: 'bool', defaultValue: false, persist: false},
{name: 'cls', type: 'string', defaultValue: null, persist: false},
{name: 'icon', type: 'string', defaultValue: null, persist: false},
{name: 'iconCls', type: 'string', defaultValue: null, persist: false},
{name: 'iconQtip', type: 'string', defaultValue: null, persist: false},
{name: 'root', type: 'boolean', defaultValue: false, persist: false},
{name: 'isLast', type: 'boolean', defaultValue: false, persist: false},
{name: 'isFirst', type: 'boolean', defaultValue: false, persist: false},
{name: 'allowDrop', type: 'boolean', defaultValue: true, persist: false},
{name: 'allowDrag', type: 'boolean', defaultValue: true, persist: false},
{name: 'loaded', type: 'boolean', defaultValue: false, persist: false},
{name: 'loading', type: 'boolean', defaultValue: false, persist: false},
{name: 'href', type: 'string', defaultValue: null, persist: false},
{name: 'hrefTarget', type: 'string', defaultValue: null, persist: false},
{name: 'qtip', type: 'string', defaultValue: null, persist: false},
{name: 'qtitle', type: 'string', defaultValue: null, persist: false}
]
});


this.treeStore = Ext.create('Ext.data.TreeStore', {
model: 'Portal.model.Device',
root: {
text: "",
id: 1,
expanded: true
},
proxy: {
...
}
});


[
{"id":"Device-50","text":"someNode","qtip":"<b>someNode<\/b>info","icon":"\/resources\/images\/TreeIconSomething.png","leaf":true}
]