Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Alloy Model Singleton with Properties back end. Just how do I get the values back after saved?

$
0
0

Hello all and thank you for taking a look.

My issue is that I am able to save to the model in properties, but unable to retrieve those values back to the model.

Some code:

The model:

exports.definition = {
    config: {
        columns: {
            "industry":         "Text",
            "email":            "Text",
            "phone":            "Text",
            "activation":       "Text",
         },
        adapter: {
            type: "properties",
            collection_name: "appState"
        }
    },
    ...
        return Model;
    },
    extendCollection: function(Collection) {
        _.extend(Collection.prototype, {
            // extended functions and properties go here
        });
 
        return Collection;
    }
};

The way it's instantiated:

Alloy.Globals.state = Alloy.Models.instance( 'appState' );
How it's populated:
Alloy.Globals.state.set( 'activation', data.ActivationCode );
//...
Alloy.Globals.state.save();
And proof that it is saved in the appState entries:
[INFO] :   ["appState-7e3c7832-df01-406f-f291-c328930e5e0e","appState-appState","appState-cc81dde7-2348-f90d-8b13-d878f1d720d7","appState-6168852d-04f2-e209-d05e-16a22a4da69d"]
However, my attempt to pull out the values in the following way:
//pull app state information from properties should they exist
Alloy.Globals.state.fetch();
Do not work. How might I go about doing it?

Viewing all articles
Browse latest Browse all 8068

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>