You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have encountered a case that seems like a bug. In your documentation I read:
"cellClassName (string|callback)
The class name of the cell (td or th). It can be a string or a callback which will be passed the model related to the current row. "
Since there is no specific documentation for an actionClassName that is defined for a view of type ActionCell, I tried to follow the above and assign a function to it that is passed the row model. That did not work.
I have fixed it by editing the source code of Backbone.Datagrid, and replacing the lines
if (this.options.actionClassName) {
a.addClass(this.options.actionClassName);
}
with
if (this.options.actionClassName) {
var actionClassName = this.options.actionClassName;
if (_.isFunction(actionClassName)) {
actionClassName = actionClassName(this.model);
}
a.addClass(actionClassName);
}
It is working ok. I wonder if you think you can include it in a next release of Backbone.Datagrid?
The text was updated successfully, but these errors were encountered:
Well there is indeed a difference between how are managed cellClassName (className for the <td>) and actionClassName (className for the <a>).
You're right, actionClassName should support receiving a callback function too so I'll add this to the next release. In the meantime feel free to open a Pull Request, I would be very pleased to merge it!
gtzoganis
pushed a commit
to gtzoganis/backbone.datagrid
that referenced
this issue
Aug 10, 2013
Hi,
Thanks for this component, it is very useful.
I have encountered a case that seems like a bug. In your documentation I read:
"cellClassName (string|callback)
The class name of the cell (td or th). It can be a string or a callback which will be passed the model related to the current row. "
Since there is no specific documentation for an actionClassName that is defined for a view of type ActionCell, I tried to follow the above and assign a function to it that is passed the row model. That did not work.
I have fixed it by editing the source code of Backbone.Datagrid, and replacing the lines
if (this.options.actionClassName) {
a.addClass(this.options.actionClassName);
}
with
if (this.options.actionClassName) {
var actionClassName = this.options.actionClassName;
if (_.isFunction(actionClassName)) {
actionClassName = actionClassName(this.model);
}
a.addClass(actionClassName);
}
It is working ok. I wonder if you think you can include it in a next release of Backbone.Datagrid?
The text was updated successfully, but these errors were encountered: