loicfrering / backbone.datagrid

A powerful component, based on Backbone.View, that displays your Backbone collections in a dynamic datagrid table.
http://loicfrering.github.io/backbone.datagrid/
MIT License
55 stars 14 forks source link

When rendering a cell, call model.toJSON() a specific option (for example view:true) #23

Closed feugy closed 11 years ago

feugy commented 11 years ago

When preparing the displayed model in callback-cell.js, it can be very handy to invoke the toJSON() method with a specific parameter.

This will allow developper to specifically format their model to fit the cell template: for example by getting embedded models attributes.

feugy commented 11 years ago

As seen directly with Loïc, we choose to add an new Cell kind, the TemplateCell, to distinguish case when:

Therefore, we modified CallbackCell to always use Backbone Model object, and add a subclass TemplateCell that render string templates from JSON serialized models.