Search code examples
javascriptbackbone.jsbackgrid

How to make editable & non editable rows with Backgrid.js in a single grid


I would like to render a grid with editable & non editable rows based on condition. I'm able to do achive setting color to differentiate this, but making it non editable for deleted records will be more useful. expecting good solutions.

var DeletedRow = Backgrid.Row.extend({
render: function () {
DeletedRow.__super__.render.apply(this, arguments);
if (!_.isUndefined(this.model.get("action")) && this.model.get("action") == "D") {
this.el.bgColor = "#C0C0C0";
}
return this;
}
});

Solution

  • This issue has bee resolved.

        var DeletedRow = Backgrid.Row.extend({
        render: function () {
        DeletedRow.__super__.render.apply(this, arguments);
        if (!_.isUndefined(this.model.get("action")) && this.model.get("action") == "D") {
        (this.$el.find("td[class=actionDescription]")).parent().find("*").unbind();
        this.$el.click(false);
        }
        return this;
        }
        });