问题
im creating a custom filter, the functionality is basically the same that is built-in in the ag-grid.
Is the:
var NumberFilter = (function () {
function NumberFilter() {
}
NumberFilter.prototype.init
The only difference is that i only need to change the function
NumberFilter.prototype.onFilterChanged
To replace commas by dots. But to overwrite all the methods it doesnt makes much sense, is there a way in inherite the functionality of the filter 'number' and change only the NumberFilter.prototype.onFilterChanged?
回答1:
You should use Javascript inheritance on NumberFilter and then overtwrite the method onFilterChanged. Check this answer to see how to do it : JavaScript override methods
Then instead of specifying
filter:'number'
You can do :
filter:new MyNumberFilter();
As you can see i instanciated the filter, it's required or you will have the same instance for all your number column's filter on the grid.
来源:https://stackoverflow.com/questions/35818793/ag-grid-inheritate-functionality