Skip to content

Commit

Permalink
A fix for Issue loicfrering#10: actionClassName callback is not passe…
Browse files Browse the repository at this point in the history
…d the corresponding model.
  • Loading branch information
Gerasimos Tzoganis committed Aug 10, 2013
1 parent 5c53ee9 commit 8579ce7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions dist/backbone.datagrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ var Table = Datagrid.Table = ComposedView.extend({
this.pager = this.options.pager;
this.sorter = this.options.sorter;

this.listenTo(this.collection, 'reset', this.render);
this.listenTo(this.collection, 'reset sort', this.render);
},

render: function() {
Expand Down Expand Up @@ -687,7 +687,11 @@ var ActionCell = Datagrid.ActionCell = Cell.extend({
a.html(this.options.label);
a.attr('href', this.options.href || '#');
if (this.options.actionClassName) {
a.addClass(this.options.actionClassName);
var actionClassName = this.options.actionClassName;
if (_.isFunction(actionClassName)) {
actionClassName = actionClassName(this.model);
}
a.addClass(actionClassName);
}
if (this.options.action) {
this.delegateEvents({
Expand Down
Loading

0 comments on commit 8579ce7

Please sign in to comment.