Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Where should I be storing my Model data?

$
0
0
Hi,
You can pass the data models to the view with control options or inside control:
  1. can.Control.extend('MyControl',{
  2.       init:function(el,opts){
  3.             //issume params
  4.             var params={
  5.                   order:'create_time', //for sorting
  6.                   offset:0
  7.             }
  8.             MyModel.findAll({params:params}).done(function(data){
  9.                   //data is can.Model.List instance (Observable can.List)
  10.                   el.html(can.view('myview',{data:data}));
  11.             });
  12.       }
  13. })
here is a great example Weekly Widget 3 - Paginated Grid
In the canjs doc look at Component paginate

Mohamed Cherif BOUCHELAGHEM

Viewing all articles
Browse latest Browse all 3491

Trending Articles