kimon
kimon

Reputation: 2505

SDK2: Using updateSettings()

I'm trying to save settings for my app. It looks like it should be simple, but this does not seem to work:

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

          ...

          launch: function() {
                var settings = this.settings;

                console.log('settings', settings);

                if (!settings.count) {
                    settings.count = 1;
                } else {
                    settings.count++;
                }

                this.updateSettingsValues(settings);

                    ... rest of App ...
            }

Always show settings as "count: 1", never increments, even as I reload multiple times. I have tried this both in and outside of Rally. I am using SDK 2.0p5.

What am I doing wrong?

Upvotes: 1

Views: 47

Answers (1)

kimon
kimon

Reputation: 2505

Ok, I took a look at the source and I figured it out...need to pass a "options" object with "settings" as a subobject. This is technically in the doc, but because it was not explained I just did what looked obvious. I think the doc needs to be update to make this more clear, it also does not speak about the completion functions you can pass in with options...

      launch: function() {
            var settings = this.settings;
            var options = { settings: settings };

            console.log('settings', settings);

            if (!settings.count) {
                settings.count = 1;
            } else {
                settings.count++;
            }

            this.updateSettingsValues(options);

                ... rest of App ...
        }

Upvotes: 1

Related Questions