Skip to content

actionClassName callback is not passed the corresponding model. #10

@gtzoganis

Description

@gtzoganis

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions