2

2.0RC3 SDK から IterationSummary アプリを変更し、さらに反復情報を追加しています。何らかの理由で、反復オブジェクトから他のフィールドを照会することはできますが、反復の「テーマ」を取得できません。サンプルから始めて、次の行 @192 を単純に追加しました。

{
    cls: 'theme',
    html: iteration.get('Theme')
},

「名前」は取得できますが、イテレーションで明確に設定されているにもかかわらず「テーマ」の値を取得できません。REST API を使用してその値を確認し、同じイテレーションを照会しました。また、「名前」などの他のフィールドのクエリもうまく機能します。「テーマ」が返されない理由は何ですか?

4

1 に答える 1

0

Do you fetch 'Theme' ?

You may see a general example that builds a grid of iterations that fall within a release (selected in the releasecombobox) that has Theme column populated as long as an iteration has a theme entered is in this github repo.

This example is different from the IterationSummary app because in my example I explicitly create Rally.data.wsapi.Store for Iteration object and fetch Theme.

Customizing the IterationSummary app will still require explicit fetching of Theme field, but you are correct that it is not obvious from the IterationSummary app how other fields are being fetched, e.g. State of iteration. The iteration object in that app is returned from this.getContext().getTimeboxScope().getRecord() and if you print out that object in the console, theme will be empty. The fields that exist on this.getContext().getTimeboxScope().getRecord() are limited and cannot be customized for performance reasons.

In order to modify this app to display Theme, the Iteration model has to be accessed and Theme fetched explicitly. Here are the steps I took to modify the app:

added getTheme function:

getTheme: function(){ 
            var iteration = this.getContext().getTimeboxScope().getRecord();
            return iteration.self.load(iteration.getId(), {
                fetch: ['Theme']
            });
        }

In rc3 every time when we have a record, .self will give its model, so there is no need to do this manually:

Rally.data.ModelFactory.getModel({
    type: 'Iteration',
    //... 

Note fetch: ['Theme']

Next, inside _addContent method getTheme() is called

return Deft.Promise.all([this.getTheme(), this.calculateTimeboxInfo()]).then({
                success: function(results) {
                    var theme = results[0].get('Theme');

and then finally theme variable's value is passed to:

{
   cls: 'theme',
   html: theme
}

The full code is available in this github repo.

于 2014-06-12T17:04:19.687 に答える