Skip to content

Instantly share code, notes, and snippets.

@Naouak
Created December 9, 2011 16:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Naouak/1452384 to your computer and use it in GitHub Desktop.
Save Naouak/1452384 to your computer and use it in GitHub Desktop.
Some modellist test
YUI.add("mymodellist",function(Y){
Y.namespace('mymvc').MyModellist = Y.Base.create(
"mymodellist",
Y.ModelList,
[],
{
model: Y.mymvc.MyModel,
fetch: function(start,count,callback){
Y.io("somejson.json",{
data: {
start: start,
count: count
},
on: {
success: Y.bind(function(id,o,args){
this.add(Y.JSON.parse(o.responseText));
callback();
},this),
failure: function(){
callback("an error");
}
}
});
},
sync: function(action,options,callback){
switch(action){
case 'read':
this.fetch(this.get("start"),this.get("count"),callback);
return;
}
}
},
{
ATTRS: {
start: {
value: 0
},
count: {
value: 20
}
}
}
);
},"0.1",{
requires : [
"mymodel",
"model-list"
]
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment