loicfrering / backbone.datagrid

A powerful component, based on Backbone.View, that displays your Backbone collections in a dynamic datagrid table.
http://loicfrering.github.io/backbone.datagrid/
MIT License
55 stars 14 forks source link

Underscore bind function on columns view #11

Open aasaidane opened 11 years ago

aasaidane commented 11 years ago

Hi, On a Backbone view, when i init my DataGrid and set the view with a function using an underscore bind like this:

this.statsGrid = new DataGrid({
                          .....
            columns: [{
                title: PageLocalizing.grid.columnsLabels.skill,
                property: 'level, processingType',
                view: _.bind(function(model) {
                    return this.getProfile(model.level, model.processingType);
                }, this ),
                sortable: true
                }
                }
            ]
            });

this don't works but if i use Jquery proxy method :

this.statsGrid = new DataGrid({
                          .....
            columns: [{
                title: PageLocalizing.grid.columnsLabels.skill,
                property: 'level, processingType',
                view: $.proxy(function(model) {
                    return this.getProfile(model.level, model.processingType);
                }, this ),
                sortable: true
                }
                }
            ]
            });

It's works