2017-07-30 66 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 
    } 
});