How can I obtain a collection of model objects?

0 views
Skip to first unread message

Confucius

unread,
Dec 21, 2009, 1:44:36 PM12/21/09
to JavaScriptMVC
I'm working with a variation on the example cookbook recipies as
'reservations'. In the Model, I have instances of 'Reservation'
objects. I created a new edit view, for manipulating just one record,
where the other records are not on the page. So when I update, I want
to return to the 'list' view and re-draw the 'reservations', not using
'findAll', but from the data in the updated Model.

I see that 'Reservation.store._data' has all of this info, but '_data'
should be treated as though it's private and inaccessible.
Nevertheless, I can code up a hack and build up the 'reservations'
array like this:

var modelData = Reservation.store._data;
var reservations = new Array();
var i = 0;
var j = 1;

for(var obj in modelData){
reservations[i] = modelData[j];
++i;
++j;
}

this.list(reservations);

I'm not sure why I can't just set 'reservations[i] = obj', but at
least got something working.

Instead of a hack like this, what would be the proper method for
obtaining this 'reservations' array?

Regards,


Justin Meyer

unread,
Dec 21, 2009, 2:02:48 PM12/21/09
to javasc...@googlegroups.com
store.find()

Justin Meyer

Jupiter Consulting
\Development\Training\Support
847-924-6039
justin...@gmail.com




--

You received this message because you are subscribed to the Google Groups "JavaScriptMVC" group.
To post to this group, send email to javasc...@googlegroups.com.
To unsubscribe from this group, send email to javascriptmv...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/javascriptmvc?hl=en.



Reply all
Reply to author
Forward
0 new messages