2

設定オブジェクトはどのように見えますか? updateSettings を何かで更新して、何か面白いものを取り戻すことができないようです。this.settings を出力すると、更新するたびに、値のないプロトタイプ オブジェクトがログに記録されます。

これが私のテストアプリの外観です。リモートで実行するのではなく、Rally 内のパネルに入れています。

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

<script type="text/javascript">
    Rally.onReady(function() {
        /*global console, Ext */

        Ext.define('CustomApp', {
            extend: 'Rally.app.App',
            componentCls: 'app',

            launch: function() {
                //Write app code here
                console.log( "settings", this.settings );
                this.updateSettings( { Name: 'test', Value: Ext.JSON.encode( { test: "blah" } ) } );
            }
        });

        Rally.launchApp('CustomApp', {
            name: 'test'
        });
    });
</script>
4

1 に答える 1

3

私が使用していたプレビュー版にバグがあることが判明しました。 そして、私は間違った種類の設定を渡そうとしていました。設定は、プロジェクトやワークスペースではなく、アプリ ID にスコープが設定されていることに注意してください。アプリの ID が必要なため、Rally の外で実行すると機能しません。

バグは、updateSettings 関数に行がないことです。同じ関数をアプリ定義に追加することで、これを簡単にオーバーライドできます (ソースがドキュメントに含まれているのは素晴らしいことではありませんか?)。次のような関数を作成するだけです。

updateSettings: function(options){
  Rally.data.PreferenceManager.updateAppPreferences({
    appID: this.getContext().get('appID'),
    settings: options.settings,
    success: function(updatedSettings){
      Ext.apply(this.settings, updatedSettings);
      if(options.success){
        options.success.call(options.scope);
      }
    },
    scope: this
  });
}

したがって、設定オブジェクトは次のように渡す必要があります。

this.updateSettings( {settings: { test: "blah" ) } } );

その後、戻ってくると、 getSetting("test") は「何とか」を返します。(名前が「test」、値が「何とか」、AppId が現在のアプリに等しい設定を作成します。

于 2012-07-30T17:53:13.893 に答える