Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Good that it's working, as there are many ways to go. I probably would have structured it a bit differently to leverage the Backbone methods that instantiate modes, but working code is the real goal, so these are just my thoughts:</p> <ul> <li><p>Rather than actually instantiate the Models in the Collection <code>parse()</code> method, merely have <code>parse</code> return an array of data objects from which Backbone would instantiate the models, and trigger a </p></li> <li><p>Rather than call fetch for the Collection inside AttendeeView, but outside the View class</p></li> <li><p>Either have AttendeeView represent the view for a single attendee, or name it AttendeeListView and have it render the list</p></li> </ul> <p>For instance:</p> <pre><code>AttendeeList = Backbone.Collection.extend({ ... parse: function(response) { // create an array of objects from which the models can be parsed var rawItems = []; $.each(response['attendees'], function(key, value) { rawItems.push({ id: data['id'], user_id: data['user_id'], meeting_id: data['id'], status: data['status'], comments: data['comments'], attended: data['datetime'], first_name: data['first_name'], last_name: data['last_name'], email: data['email'], counter: this.counter, user_uuid: data['user_uuid'], unavailable_dates: data['unavailable_dates'] }); }); return rawItems; }, ... } </code></pre> <p>and then either use the success/failure call backs:</p> <pre><code> AttendeeList.fetch( onListFetchSuccess , onListFetchFail ); </code></pre> <p>or listen for the <code>reset</code> event that gets triggered:</p> <pre><code> AttendeeList.on('reset', createAttendeeListView ); </code></pre> <p>(I didn't actually edit and run the code, this is just an outline)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload