How to override and/or overload webix library methods???

How to override and/or overload webix library methods???

is it possible in webix?

In few we need to add some add-on functionality methods which are in webix.

Let’s say clearSelection method in datatable, we need to add some code to this method.

How can we achieve this?

Hello @webix_B_123,

How to override and/or overload webix library methods???

Generally speaking, webix.protoUI lets you create a custom component either from scratch or by extending the functionality of already existing components. This also allows you to redefine some of the methods used by the view you wish to modify.

For instance, here is an example of rewriting a method in a way that implies extending the already existing functionality: https://snippet.webix.com/8ss2nnal.

Let’s say clearSelection method in datatable, we need to add some code to this method.

You can redefine the default clearSelection method using the aforementioned protoUI approach. This can be done inside of the selection_setter which stores the required method.

Here is an example of extending the already existing function: https://snippet.webix.com/n2s9ryzs. Please note that the clearSelection() method in particular gets called by the existing methods already (i.e. unselectAll()), which might cause some unfortunate side effects.

Alternatively, you can replace the already existing method with your own - https://snippet.webix.com/t7pi77ky.

Thanks DZmitry