Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/typo3/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sencha touch 设置嵌套列表的“工具栏”属性_Sencha Touch_Nested Lists - Fatal编程技术网

Sencha touch 设置嵌套列表的“工具栏”属性

Sencha touch 设置嵌套列表的“工具栏”属性,sencha-touch,nested-lists,Sencha Touch,Nested Lists,我是新来Sencha Touch 1的。我想向默认的NestedList工具栏添加更多项,但找不到使用toolbar属性的工作示例 发件人: 我做到这一点的唯一方法是在创建NestedList时使用initComponent方法,但我觉得我正在重新发明轮子 var myNestedList= new Ext.NestedList({ fullscreen: true, title: 'myTitle', useToolbar: true, store: mySto

我是新来Sencha Touch 1的。我想向默认的NestedList工具栏添加更多项,但找不到使用toolbar属性的工作示例

发件人:

我做到这一点的唯一方法是在创建NestedList时使用initComponent方法,但我觉得我正在重新发明轮子

var myNestedList= new Ext.NestedList({
    fullscreen: true,
    title: 'myTitle',
    useToolbar: true,
    store: myStore,
    initComponent : function() {
            ...
            } 
…修改此部分

if (this.useToolbar) {
    // Add the back button
    this.backButton = new Ext.Button({
        text: this.backText,
        ui: 'back',
        handler: this.onBackTap,
        scope: this,
        // First stack doesn't show back
        hidden: true
    });

    // MY ADDED CODE
    var buttonsSpec = [
        { xtype: 'spacer' },
        { xtype: 'searchfield', placeHolder: 'Search', name: 'search' }
    ];
            // END MY ADDED CODE


    //this.searchButton.addListener('action', searchHandler);
    if (!this.toolbar || !this.toolbar.isComponent) {

                 /**
         * @cfg {Object} toolbar
         * Configuration for the Ext.Toolbar that is created within the Ext.NestedList.
         */
        this.toolbar = Ext.apply({}, this.toolbar || {}, {
            dock: 'top',
            xtype: 'toolbar',
            ui: 'light',
            title: title,
            items: [buttonsSpec] //MY ADDED CODE, WAS items: []
        });

        this.toolbar.items.unshift(this.backButton);
        this.toolbar = new Ext.Toolbar(this.toolbar);

        this.dockedItems = this.dockedItems || [];
        this.dockedItems.push(this.toolbar);
    } else {
        this.toolbar.insert(0, this.backButton);
    }
}

这不是您的搜索范围,但可能是另一种解决方案

创建自己的工具栏并将其放在页面顶部,禁用嵌套列表工具栏

useToolbar:false,
和用于后退按钮处理程序;这个方法帮助你

nestedlist.onBackTap();

希望能有所帮助。

谢谢ykartal,我已经考虑过您的解决方案,但我对正确使用工具栏属性感兴趣
nestedlist.onBackTap();