Created
March 9, 2016 15:52
-
-
Save CraigCav/e26f7bbca1939bc143c7 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
function getAnimals() { | |
var dataSource = this; | |
var ajax = $.ajax({ | |
type: 'GET', | |
url: '/my/remote/endpoint/', | |
data: { | |
limit: dataSource.pager.limit(), | |
startIndex: dataSource.pager.limit() * ( dataSource.pager.page() – 1 ) | |
}, | |
dataType: 'json' | |
}); | |
return Promise.resolve(ajax).then(function(data) { | |
dataSource( data.rows ); | |
dataSource.pager.totalCount( data.count ); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment