2013-07-30 2 views

ответ

2

Этот код использует rallyprojectpicker и обновляет сетку на основе выбора проекта:

<!DOCTYPE html> 
<html> 
<head> 
    <title>Stories By Project</title> 

    <script type="text/javascript" src="https://rally1.rallydev.com/apps/2.0rc1/sdk.js"></script> 

    <script type="text/javascript"> 
     Rally.onReady(function() { 
      Ext.define('CustomApp', { 
       extend: 'Rally.app.App', 
       componentCls: 'app', 

       items: [ 
        { 
         xtype: 'container', 
         itemId: 'projFilter' 
        }, 
        { 
         xtype: 'container', 
         itemId: 'grid' 
        } 
       ], 

       launch: function() { 

        this.down('#projFilter').add({ 
      xtype: 'rallyprojectpicker', 
         itemId: 'projPicker', 
      workspace: '/workspace/12352608129', 
      value: '/project/12527515559', //default 
         listeners: { 
          change: this._onProjectChange, 
          scope: this 
         } 
        }); 
       }, 

     _onProjectChange: function() 
     { 
      if(!this.model) { 
       this._retrieveModel(); 
      } else { 
       this._refreshGrid(); 
      } 
     }, 

       _retrieveModel: function(comboBox) { 
        Rally.data.ModelFactory.getModel({ 
         type:'UserStory', 
         success:this._onModelRetrieved, 
         scope: this 
        }); 
       }, 

       _refreshGrid: function() { 
      this.grid.reconfigure(this._buildStore()); 
       }, 

     _buildStore: function() { 
      return Ext.create('Rally.data.WsapiDataStore', { 
       model: this.model, 
       autoLoad: true, 
       context: { 
        projectScopeUp: false, 
        projectScopeDown: false, 
        project: this.down('#projPicker').getValue() 
       } 
     }); 
     }, 

       _onModelRetrieved: function(model) { 
      this.model = model; 
        this.grid = this.down('#grid').add({ 
          xtype:'rallygrid', 
       store: this._buildStore(), 
          columnCfgs:[ 
           'FormattedID', 
           'Name' 
          ] 

        }); 
       } 
      }); 

      Rally.launchApp('CustomApp', { 
       name: 'Stories By Project' 
      }); 
     }); 
    </script> 

    <style type="text/css"> 
    </style> 
</head> 
<body></body> 
</html> 
Смежные вопросы