Refresh second filter based on selection of first

How to refresh the content of the second filter (all other filters) based on selection of the first filter?
I see that was answered in 2012 related to TreeGrid. Will it work with basic Grid? Maybe there is newer solution?
viewtopic.php?f=2&t=26497&p=83571&hilit=refresh+filter#p83571
Thank you.

In case of dhtmlxGrid that will be a line in dhtmlxgrid_filter.js

var col=this._f_rowsBuffer||this.rowsBuffer;

if you change it to the

var col=this.rowsBuffer;

and will call grid.refreshFilter(index), the related filter will be filled only with filtered options.

Thank you.
Can I overwrite dhtmlXGridObject.prototype.collectValues locally in order not to mess up with core code?
Edit: answer is yes.
I wonder why this is not a default behavior. Kind of makes sense.
Thank you