UI, histories: correct allFetched setting in setCollection to allow fetching after changing collection order

This commit is contained in:
Carl Eberhard
2015-09-03 16:42:48 -04:00
parent 9df1dfafeb
commit 8430ca4e3f
6 changed files with 9 additions and 6 deletions
@@ -492,6 +492,8 @@ var HistoryCollection = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).ext
this.setOrder( options.order || this.DEFAULT_ORDER );
/** @type {String} encoded id of the history that's current */
this.currentHistoryId = options.currentHistoryId;
/** @type {boolean} have all histories been fetched and in the collection? */
this.allFetched = options.allFetched || false;
// this.on( 'all', function(){
// console.info( 'event:', arguments );
@@ -580,8 +582,10 @@ var HistoryCollection = Backbone.Collection.extend( BASE_MVC.LoggableMixin ).ext
* and set allFetched/fire 'all-fetched' when xhr returns
*/
fetch : function( options ){
console.debug( 'fetch', this.allFetched );
options = options || {};
if( this.allFetched ){ return jQuery.when({}); }
console.debug( 'fetching' );
var collection = this,
fetchOptions = _.defaults( options, {
remove : false,
@@ -439,7 +439,6 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
this.stopListening( this.collection );
this.collection = collection || new HISTORY_MODEL.HistoryCollection();
this.collection.allFetched = !this.perPage || ( this.collection.length < this.perPage );
this.setUpCollectionListeners();
this.collection.sort({ silent : true });
@@ -454,7 +453,7 @@ var MultiPanelColumns = Backbone.View.extend( baseMVC.LoggableMixin ).extend({
/** Set up a (new) history collection, sorting and adding listeners
* @fires 'new-collection' when set with this view as the arg
*/
addModels : function setCollection( models, collection, options ){
addModels : function addModels( models, collection, options ){
options = options || {};
var multipanel = this;
models = _.isArray( models )? models : [ models ];
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long