Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Old question, I know, but to solve this, you can remove the toolbar from the list (without destroying it) and add it to a panel above the list. All nestedList functionality stays the same on the toolbar. Here's the solution I have:</p> <p>First, I created a view that extends from NestedList and contains a toolbar:</p> <pre><code>Ext.define('MyApp.view.DynamicList', { extend: 'Ext.dataview.NestedList', alias: 'widget.dynamiclist', config: { toolbar: { xtype: 'toolbar', docked: 'top', itemId: 'header-bar', layout: { pack: 'end', type: 'hbox' }, items: [ { xtype: 'spacer' }, { xtype: 'button', itemId: 'show-nav-sheet-button', ui: 'plain', width: 45, iconCls: 'more' } ] } } }); </code></pre> <p>Next, I created a main panel with a vbox layout that contains a child panel and this toolbar:</p> <pre><code>Ext.define('MyApp.view.MainContainer', { extend: 'Ext.Container', requires: [ 'MyApp.view.DynamicList' ], config: { id: 'main-container', layout: { type: 'vbox' }, items: [ { xtype: 'panel', flex: 1, itemId: 'info-container' }, { xtype: 'dynamiclist', flex: 1 } ] } }); </code></pre> <p>Then, in a controller, I listen for the initialize event of the nested list. When it's fired, I remove the toolbar from the nested list and add it to the panel. </p> <pre><code>onNestedListInitialize: function() { // need to wait until everythin is initialized; var me = this; var renderFn = function renderPanels() { var main = me.getMainContainer(); // wait until main is intialized; if(!main) { Ext.defer(renderFn, 50, this); return; } var list = main.down('#my-list'); var infocont = main.down('#info-container'); // wait until the container's components are initialized if(!list || !infocont) { Ext.defer(renderFn, 50, this); return; } // remove the toolbar from the list, and add it to the container. var toolbar = list.down('#header-bar'); list.remove(toolbar, false); infocont.add(toolbar); } // call the function for the first time. renderFn(); } </code></pre> <p>Note, I had to add a few checks to make sure the components were correctly initialized before using them, but the heart of it comes to the list.remove(toolbar, false) followed by the infocont.add(toolbar) commands. The false flag in the .remove() method means that the item won't be destroyed, so it's available to be re-added to the panel.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload