},\r
\r
fetchSuccess: function(collection, response, options) {\r
+ //console.log("fetch succeeded " + collection.modelName);\r
this.failedLoad = false;\r
+ this.fetching = false;\r
if (!this.isLoaded) {\r
this.isLoaded = true;\r
Backbone.trigger("xoslib:collectionLoadChange", this);\r
}\r
+ this.trigger("fetchStateChange");\r
if (options["orig_success"]) {\r
options["orig_success"](collection, response, options);\r
}\r
},\r
\r
fetchFailure: function(collection, response, options) {\r
+ //console.log("fetch failed " + collection.modelName);\r
+ this.fetching = false;\r
if ((!this.isLoaded) && (!this.failedLoad)) {\r
this.failedLoad=true;\r
Backbone.trigger("xoslib:collectionLoadChange", this);\r
}\r
+ this.trigger("fetchStateChange");\r
if (options["orig_failure"]) {\r
options["orig_failure"](collection, response, options);\r
}\r
\r
fetch: function(options) {\r
var self=this;\r
+ this.fetching=true;\r
+ //console.log("fetch " + this.modelName);\r
if (!this.startedLoad) {\r
this.startedLoad=true;\r
Backbone.trigger("xoslib:collectionLoadChange", this);\r
}\r
+ this.trigger("fetchStateChange");\r
if (options == undefined) {\r
options = {};\r
}\r
}
},
+ refresh: function(refreshRelated) {
+ if (!this.fetching) {
+ this.fetch();
+ }
+ if (refreshRelated) {
+ for (related in this.relatedCollections) {
+ related = xos[related];
+ if (!related.fetching) {
+ related.fetch();
+ }
+ }
+ }
+ },
+
maybeFetch: function(options){
// Helper function to fetch only if this collection has not been fetched before.
if(this._fetched){