【发布时间】:2013-12-20 20:21:52
【问题描述】:
我的星期五晚上花在解决意外问题上)这是关于如何禁用 NestedList 组件中的原生工具栏(对于 Sencha touch 2.3.1)。
NestedList 默认使用 Toolbar 创建。最后一个有默认配置:
工具栏:{停靠:'top',xtype:'titlebar',ui:'light',内联:true}
根据 API docs.sencha.com/touch/2.3.1/#!/api/Ext.dataview.NestedList-cfg-toolbar 工具栏配置看起来像
工具栏:Ext.Toolbar/Object/Boolean
所以我认为布尔值意味着显示(真)或不显示(假)
好吧,让我们做一些magic练习,这是我的例子:
var data = {
text: 'Groceries',
items: [{
text: 'Drinks',
items: [{
text: 'Water',
items: [{
text: 'Sparkling',
leaf: true
}, {
text: 'Still',
leaf: true
}]
}, {
text: 'Coffee',
leaf: true
},]
}, ]
};
Ext.define('ListItem', {
extend: 'Ext.data.Model',
config: {
fields: [{
name: 'text',
type: 'string'
}]
}
});
var store = Ext.create('Ext.data.TreeStore', {
model: 'ListItem',
defaultRootProperty: 'items',
root: data
});
var nestedList = Ext.create('Ext.NestedList', {
fullscreen: true,
title: 'Groceries',
displayField: 'text',
store: store,
//toolbar: false
});
取消注释// toolbar: false 会导致错误,例如
uncaught TypeError: Object # has no method 'insert'
等等。看起来像 Sencha 尝试在不存在的组件上执行 'insert' 方法(因为它被禁用,工具栏设置为 false)
【问题讨论】:
标签: extjs sencha-touch sencha-touch-2