Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Pattern to render a grouping of rows
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  9 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Joe Gornick  
View profile  
 More options Aug 17 2012, 1:11 pm
From: Joe Gornick <jgorn...@gmail.com>
Date: Fri, 17 Aug 2012 10:11:26 -0700 (PDT)
Local: Fri, Aug 17 2012 1:11 pm
Subject: Pattern to render a grouping of rows

Hi!

I'm trying to find a pattern that takes a collection of data and produces
rows with 3 items in each row. My domain is I'm working with is a Unit that
has many Measurements. I need to render those Measurements as a small
widget to display the measurement name and last value recorded.

An example of markup would be something like:

<div class="measurements-grid">
  <div class="row-fluid">
    <!-- 3 measurements per row -->    
    <div class="span4 thumbnail measurement">
      <span class="name">{{ measurement.name }}</span>
      <span class="value">{{ value }}</span>
      <div class="graph"></div>
    </div>
  </div>
  <!-- 12 total measurements would be 4 rows -->
</div>

Any help would be greatly appreciated!

Thanks!

 - Joe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Derick Bailey  
View profile  
 More options Aug 18 2012, 11:46 am
From: Derick Bailey <derickbai...@gmail.com>
Date: Sat, 18 Aug 2012 10:46:36 -0500
Local: Sat, Aug 18 2012 11:46 am
Subject: Re: [Backbone.Marionette] Pattern to render a grouping of rows

Hi Joe,

A CollectionView or CompositeView would do this easily, with an itemView that renders a "row-fluid" for each item in the collection.

  -- Derick


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe Gornick  
View profile  
 More options Aug 18 2012, 12:30 pm
From: Joe Gornick <jgorn...@gmail.com>
Date: Sat, 18 Aug 2012 09:30:45 -0700 (PDT)
Local: Sat, Aug 18 2012 12:30 pm
Subject: Re: [Backbone.Marionette] Pattern to render a grouping of rows

Hey Derick,

Ok, that makes sense, but how would you setup the rendering process to
create a new ItemView that represents a row for every 3 measurements? Would
you have to create a custom collection that has the measurements grouped?

Thanks!

 - Joe


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Derick Bailey  
View profile  
 More options Aug 18 2012, 1:13 pm
From: Derick Bailey <derickbai...@gmail.com>
Date: Sat, 18 Aug 2012 12:13:30 -0500
Local: Sat, Aug 18 2012 1:13 pm
Subject: Re: [Backbone.Marionette] Pattern to render a grouping of rows

The measurement data should be returned from your server already grouped, so that each model is 1 group of 3 measurements.

IMO, Backbone models are view-models, not relational models. They are meant to be tailored to the specific screens that they are used on. You don't want to do grouping, filtering and other relational functions on the browser if you don't have to.

  -- Derick


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Levy  
View profile  
 More options Aug 18 2012, 1:18 pm
From: Robert Levy <robertl...@live.com>
Date: Sat, 18 Aug 2012 13:18:11 -0400
Local: Sat, Aug 18 2012 1:18 pm
Subject: RE: [Backbone.Marionette] Pattern to render a grouping of rows

If you can't change the service for some reason, implementing a 'parse' function on your Model is a good way to restructure the data into a more suitable viewmodel
________________________________
From: Derick Bailey
Sent: 8/18/2012 1:13 PM
To: backbone-marionette@googlegroups.com
Subject: Re: [Backbone.Marionette] Pattern to render a grouping of rows

The measurement data should be returned from your server already grouped, so that each model is 1 group of 3 measurements.

IMO, Backbone models are view-models, not relational models. They are meant to be tailored to the specific screens that they are used on. You don't want to do grouping, filtering and other relational functions on the browser if you don't have to.

  -- Derick

--
You received this message because you are subscribed to the Google Groups "Backbone.Marionette" group.
To post to this group, send email to backbone-marionette@googlegroups.com.
To unsubscribe from this group, send email to backbone-marionette+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Joe Gornick  
View profile  
 More options Aug 18 2012, 1:28 pm
From: Joe Gornick <jgorn...@gmail.com>
Date: Sat, 18 Aug 2012 10:28:31 -0700 (PDT)
Local: Sat, Aug 18 2012 1:28 pm
Subject: Re: [Backbone.Marionette] Pattern to render a grouping of rows

Sounds good! Thanks Derick and Robert!


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bryan Buchs  
View profile  
 More options Nov 16 2012, 10:35 am
From: Bryan Buchs <buchs.br...@gmail.com>
Date: Fri, 16 Nov 2012 07:35:31 -0800 (PST)
Local: Fri, Nov 16 2012 10:35 am
Subject: Re: [Backbone.Marionette] Pattern to render a grouping of rows

> The measurement data should be returned from your server already grouped,
> so that each model is 1 group of 3 measurements.
> IMO, Backbone models are view-models, not relational models. They are
> meant to be tailored to the specific screens that they are used on. You
> don't want to do grouping, filtering and other relational functions on the
> browser if you don't have to.

What if I have one collection that should be used with multiple views?

As an example: a photo gallery with an index view in a "grid" layout, and a
modal overlay layout that contains an item detail view and a list of those
same thumbs in a single row. It seems wasteful to fetch the collection from
the server twice. Where would be the most appropriate method to reformat
the response?


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ruben Vreeken  
View profile  
 More options Nov 16 2012, 11:09 am
From: Ruben Vreeken <ruben.vree...@gmail.com>
Date: Fri, 16 Nov 2012 17:08:18 +0100
Local: Fri, Nov 16 2012 11:08 am
Subject: Re: [Backbone.Marionette] Pattern to render a grouping of rows

You could override the appendHTML method on your compositeView to append
the rendered itemViews to the compositeView and insert new rows as needed.
Not sure if that's the cleanest way to do it because you'll be moving some
markup out of the template and into the view, but at least it's dead simple
and doesn't require you to either modify your collections or keep separate
collections of the same data due to multiple views with different needs.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Bryan Buchs  
View profile  
 More options Nov 16 2012, 3:48 pm
From: Bryan Buchs <buchs.br...@gmail.com>
Date: Fri, 16 Nov 2012 12:48:56 -0800 (PST)
Local: Fri, Nov 16 2012 3:48 pm
Subject: Re: [Backbone.Marionette] Pattern to render a grouping of rows

I took another stab at this, and here's what I came up with:

http://jsfiddle.net/bryanbuchs/c72Vg/

I've been working with Backbone for all of 2 weeks, and Marionette for
about 4 days... so while this might work, I'm sure it could use some work.
In short: The "grid" CompositeView manipulates the collection during
initialize, grouping it into rows of 4 before the "row" and "item" views
are run.

What I couldn't figure out was how to pass the grouped data from the grid
to the row as something I could grab easily. What I ended up doing was to
dump the data into new generic Collection objects. If anyone has
suggestions on how to clean this up, I'm all ears.

-- Bryan


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »