首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Iteration.StartDate不可用

Iteration.StartDate不可用
EN

Stack Overflow用户
提问于 2016-09-22 20:43:18
回答 2查看 122关注 0票数 1

当我使用Rally.data.WsapiDataStore查询用户故事时,我可以检索Iteration.StartDate和Iteration.EndDate。但是,当我使用.getCollection(“前身”)加载集合时,将加载迭代名,但不会填充StartDate和EndDate。应用程序代码写入控制台以检查迭代对象。

代码语言:javascript
复制
<!DOCTYPE html>
<html>
<head>
    <title>Rally</title>

    <script type="text/javascript" src="/apps/2.0rc3/sdk.js"></script>

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

  launch: function() {
    MyApp = this;

    MyApp.globalContext = this.getContext().getDataContext();
    MyApp.PredecessorSearch = [];

    Ext.getBody().mask('Loading...' );

    // Update the filter
    var filter = Ext.create('Rally.data.QueryFilter', {
      property: 'DirectChildrenCount',
      operator: '=',
      value: '0'
    });

    var filter2 = Ext.create('Rally.data.QueryFilter', {
      property: 'ScheduleState',
      operator: '!=',
      value: 'Accepted'
    });

    filter = filter.and( filter2 );

    Ext.create('Rally.data.WsapiDataStore', {
      autoLoad: true,
      limit: Infinity,
      model: 'UserStory',
      context: MyApp.globalContext,
      fetch: ['Feature', 'Parent', 'Children',
              'FormattedID', 'Name', 
              'ScheduleState', 'c_DevKanban',
              'Release', 'Iteration', 'StartDate', 'EndDate', 
              'Blocked', 'BlockedReason', 
              'Predecessors',
              'Owner','ObjectID' ],
      filters: [ filter ],
      sorters: [{
        property: 'Rank',
        direction: 'ASC'
      }],
      listeners: {
        load: function (store, records) {
          Ext.each(records, function(record) {
            record.data.PredecessorData = [];

            console.log( "Story " + record.data.FormattedID, record.data.Iteration );

            // Look for predecessors
            //console.log( record.data.Predecessors );
            if ( record.data.Predecessors && 
                 record.data.Predecessors.Count > 0 ) {
              MyApp._loadPredecessorsInStory( record );
            }
            // End of look for associated predecessors
          });

          var wait = function(condFunc, readyFunc, checkInterval) {
            var checkFunc = function() {
              if( condFunc() ) { readyFunc(); }
              else             { setTimeout(checkFunc, checkInterval); }
            };
            checkFunc();
          };

          MyApp.PredecessorSearch.push( 'END' );

          wait(
            function() { 
              return ( MyApp.PredecessorSearch[0] == 'END' ); 
            }, 
            function() { 
              Ext.getBody().unmask();
            },
            1000
          );
        }
      }
    });
  },

  _loadPredecessorsInStory: function ( userStory ) {
    // Add this user story to the end of the list
    MyApp.PredecessorSearch.push( userStory.data.FormattedID );

    userStory.getCollection('Predecessors').load({
      scope: this,
      autoLoad: true,
      limit: Infinity,
      context: MyApp.globalContext,
      fetch: ['Requirement',
              'FormattedID', 'Name', 
              'State', 'ScheduleState', 'c_DevKanban',
              'Release', 'Iteration', 'StartDate', 'EndDate', 
              'Blocked', 'BlockedReason', 
              'Owner','ObjectID' ],
      filters: [ {
        property: 'ScheduleState',
        operator: '!=',
        value: 'Accepted' }
      ],
      callback: function(records, operation, success){
        Ext.Array.each(records, function(record){
          console.log( "Predecessor " + record.data.FormattedID, record.data.Iteration );
        });

        // Remove this user story from the front of the list
        MyApp._removeElement( MyApp.PredecessorSearch, userStory.data.FormattedID );
      }
    });
  },

  _removeElement: function( array, element ) {
    for(var i = array.length - 1; i >= 0; i--) {
      if(array[i] === element) {
        array.splice(i, 1);
        return true;
      }
    }  

    return false;
  }
});


            Rally.launchApp('CustomApp', {
                name:"Rally",
                parentRepos:""
            });

        });
    </script>


</head>
<body>
</body>
</html>
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2016-09-22 22:36:44

我似乎还记得这是getCollection方法2.0rc3版本中的一个bug。如果在config参数中传递fetch,而不是将其传递给load,该怎么办?

代码语言:javascript
复制
userStory.getCollection('Predecessors', {
    fetch: ['Iteration', 'StartDate', 'EndDate', etc...]
}).load()...

您还可以尝试升级到最新的SDK版本- 2.0或最新的2.1.

票数 1
EN

Stack Overflow用户

发布于 2016-09-23 07:53:43

我不知道您是希望填充"StartDate“和"EndDate”字段,还是希望填充fetch[]中定义的“Iteration.EndDate”和“Iteration.StartDate”字段。第一个不存在于用户故事(这是getCollection将要返回的类型),它们只存在于迭代类型上。

我认为KyleM指的是为类型获取的默认字段,除非您用另一个列表覆盖列表--当被获取的项是getCollection的一部分时,我不知道该如何做(这将采用您指定的配置,而不是将其传递给迭代数据的获取)。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/39648551

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档