2017-07-30 72 views
0

我想創建組合框列出所有按名稱過濾的組合項/特徵。這裏是我的代碼拉力組合框在單擊時不起作用

 Ext.define('Rally.Dashboard', { 
      extend: 'Rally.app.App', 
      launch: function() { 
       if (this.down('#features')) { 
        this.down('#features').destroy(); 
       } 

       var features = Ext.create('Rally.ui.combobox.ComboBox', { 
        itemId: 'features', 
        allowNoEntry: false, 
        storeConfig: { 
         model: 'PortfolioItem/Feature', 
         fetch: ['FormattedID', 'Name', 'ObjectID', 'UserStories'], 
         autoSelect: true, 
         pageSize: 100, 
         autoLoad: true, 
         filters: [this._getFilter()] 
        }, 
        fieldLabel: 'Select Feature', 
        listeners: { 
         ready: function (combobox) { 
          if (combobox.getRecord()) { 
           this._onFeatureSelected(combobox.getRecord()); 
          } 
         }, 
         select: function (combobox) { 
          if (combobox.getRecord()) { 
           this._onFeatureSelected(combobox.getRecord()); 
          } 

         }, 
         scope: this 
        } 
       }); 
       this.add(features); 

      }, 
      _onFeatureSelected: function (feature) { 

       console.log('feature', feature.get('Name')); 


      },//_onFeatureSelected 

      _getFilter: function() 
      { 
       return { 
        property: 'Name', 
        operator: 'Contains', 
        value: 'Feature' 
       } 
      } 

     }); 
     Rally.launchApp('Rally.Dashboard', { 
      name: 'example' 
     }); 

當儀表板第一次加載時,一切正常。但是當我單擊組合框時,組合框將被清除,並在日誌中顯示響應錯誤

「QueryResult」:{「Errors」:[「Could not parse:Could not find attribute \」_ refObjectName \ 「在查詢段\」_ refObjectName \「」「,」TotalResultCount「:0,」StartIndex「:0,」PageSize「:0,」Results「:[]}}中鍵入PortfolioItems)

回答

0

啊,combobox 。不幸的是,由於整個產品使用了許多不同的用法,並且隨着時間的推移,一對不兼容的ExtJS升級,因此這個組件的使用壽命很長。

有,我會建議使用,而不是一個非常好的神器搜索組合框,因爲我認爲它處理了一堆古怪(包括預輸入搜索)對你:

var features = Ext.create('Rally.ui.combobox.ArtifactSearchComboBox', { 
    itemId: 'features', 
    allowNoEntry: false, 
    storeConfig: { 
     models: ['PortfolioItem/Feature'], 
     fetch: ['FormattedID', 'Name', 'ObjectID', 'UserStories'], 
     pageSize: 100, 
     autoLoad: true // or false if you want to wait to load until click 
    }, 
    fieldLabel: 'Select Feature', 
    listeners: { 
     ready: function (combobox) { 
      if (combobox.getRecord()) { 
       this._onFeatureSelected(combobox.getRecord()); 
      } 
     }, 
     select: function (combobox) { 
      if (combobox.getRecord()) { 
       this._onFeatureSelected(combobox.getRecord()); 
      } 
     }, 
     scope: this 
    } 
});