2011-12-17 4 views
0

Sencha Touch 1을 처음 사용했습니다. 기본 NestedList 도구 모음에 항목을 추가하고 싶지만 "toolbar"속성을 사용하는 실제 예제를 찾을 수 없습니다.중첩 된 목록의 "toolbar"속성 설정

Sencha Docs에서

: 나는 NestedList를 만들 때 initComponent 함수 방법을 사용하고이 작업을 수행하기 위해 관리

toolbar : Object 
Ext.Toolbar shared across each of the lists. This will only exist when useToolbar is true which is the default. 

유일한 방법,하지만 난 바퀴를 개혁하고있어 같은 느낌 ...

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); 
    } 
} 

답변

0

이것은 검색 범위가 아니지만 대안 솔루션이 될 수 있습니다.

고유 한 도구 모음을 만들어 페이지 상단에 배치하고 중첩 목록 도구 모음을 사용하지 않도록 설정하십시오.

useToolbar:false, 

및 back button handler; 이 방법으로 도움이됩니다.

nestedlist.onBackTap(); 

도움이되기를 바랍니다.

+0

감사합니다. ykartal, 저는 이미 귀하의 솔루션을 고려해 봤지만 "툴바"속성의 적절한 사용에 관심이 있습니다. – baffonero

관련 문제