While it seems I can remove some rows, is it possible to skip rendering of some rows based on some filtering logic?
e.g. don't render a row where model.get('someProp') == 'X'
While it seems I can remove some rows, is it possible to skip rendering of some rows based on some filtering logic?
e.g. don't render a row where model.get('someProp') == 'X'
I guess css-solution, e.g. display:none;
, is ok? Hence, you may play with classNames by just extending the row model you use (backbone native functionality):
...
options.row = Backgrid.Row.extend({
className: function() {
return this.model.get('property') == 1 ? 'renderme' : 'hideme';
}
});
var grid = new Backgrid.Grid(options);
And then apply whatever styles you want to those classes.
Of course, you could override the render
-method of Backgrid.Row
by extending it and check the models property there, but you would end up overriding Backgrid.Body
as well.
I find using css class names being more flexible multi-purpose solution.