Ag-grid inheritate functionality

孤人 提交于 2019-12-25 06:44:43

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!