I created a model which contains a proxy to load a single record and its takes no params. I don’t want to use a store since I’ll never have more then one record. I create an instance of the Model but can’t figure out how to tell it to call and load the record from the server. This is the only example I could find, but I don’t have an id to pass.
User.load(123, {
success: function(user) {
console.log("Loaded user 123: " + user.get('name'));
}
});
Also I’m making and ajax call and not a rest call in case that matters.
The load(id, [config]) is static and will
returnprovide you with a new record instance. It uses the proxy that was set via setProxy(proxy) (also static). Per default it will send a read request with the paramsid: 123. The static method allows you to set some default callbacks within the optional config object. These callbacks are needed to get the instance of the loaded record (or the error).How it works
Not what you need? Just comment…