Created
September 23, 2008 02:35
-
-
Save erichocean/12208 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Call this to force the list to refresh. The refresh may not happen | |
right away, depending on the dataSource. | |
*/ | |
refresh: function() { | |
var recordType = this.get('recordType') || SC.Record ; | |
var offset = (this._limit > 0) ? this._offset : 0 ; | |
if (!this._boundRefreshFunc) { | |
this._boundRefreshFunc = this._refreshDidComplete.bind(this) ; | |
} | |
// start refresh | |
if (!this.dataSource) throw "collection does not have dataSource" ; | |
this.beginPropertyChanges(); | |
if (!this.isLoading) this.set('isLoading',true) ; | |
this._refreshing = true ; | |
var order = this.get('orderBy') ; | |
if (order && !(order instanceof Array)) order = [order] ; | |
this.dataSource.listFor({ | |
recordType: recordType, | |
offset: offset, | |
limit: this._limit, | |
conditions: this.get('conditions'), | |
order: order, | |
callback: this._boundRefreshFunc, | |
cacheCode: this._cacheCode | |
}) ; | |
this.endPropertyChanges() ; | |
return this; | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment