Skip to content

Instantly share code, notes, and snippets.

@thomaslang
Created May 14, 2009 19:59
Show Gist options
  • Save thomaslang/111864 to your computer and use it in GitHub Desktop.
Save thomaslang/111864 to your computer and use it in GitHub Desktop.
_applyChangedOrder: function() {
if (!this.queryKey) return;
// clear cache
this._records = null;
// this actually sorts the store keys
this.storeKeys.sort();
// setting them manually works as well
//this.storeKeys = [key2, key1];
// this doesn't work
//SC.Query.orderStoreKeys(this.get('storeKeys'), this.get('queryKey'), this.get('store'));
// this doesn't work, too
//SC.Query._TMP_STORE = this.store;
//SC.Query._TMP_QUERY_KEY = this.queryKey;
//this.storeKeys.sort(this.queryKey.compareStoreKeys);
//delete SC.Query._TMP_STORE;
//delete SC.Query._TMP_QUERY_KEY;
// left overs
//console.log(this.queryKey.orderIsReady);
//var newStoreKeys = this.get('storeKeys');
//var key1 = this.storeKeys[0];
//var key2 = this.storeKeys[1];
//SC.Query.orderStoreKeys(this.get('storeKeys'), this.get('queryKey'), this.get('store'));
//newStoreKeys = SC.Query.containsStoreKeys(this.get('queryKey'), this.get('storeKeys'), this.store);
//this.storeKeys = newStoreKeys.addObserver('[]', this, this._storeKeysContentDidChange);
//this.storeKeys = [key2, key1];
//this.set('storeKeys', [key2, key1]);
//
//this.beginPropertyChanges()
// .notifyPropertyChange('length')
// .enumerableContentDidChange()
//.endPropertyChanges();
//this.set('storeKeys', [key1, key2]);
//console.log(this.queryKey.orderIsReady);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment