We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Extend or override controls

Hi,

Is there any way to extend or override ej controls?

Thanks.

Lucía

1 Reply

HP Harikrishnan P Syncfusion Team March 6, 2014 04:43 PM UTC

Hi Lucia,                                                        

Thanks for your interest in Syncfusion product.

Yes, it is possible to extend our JS controls. To extend or overwrite the functionalities of JS controls, use the prototype object, by which you can create custom methods and properties. Consider a scenario, you want the autocomplete widget to display the suggestions only when you press the backspace key. This can be achieved by the following code snippet.

    // Define this method before Autocomplete initialization

            var click = ej.Autocomplete.prototype._OnKeyUp;

            ej.Autocomplete.prototype._OnKeyUp = function (e) {

                if (e.keyCode == 8) {

    // {handle the custom event or method here}

    // if you want the original method to be executed call the Autocomplete original method

                    click.call(this, e);

                }

            }

Similarly it is possible to create or extend the events and methods of JS controls.

 

Regards,

HariKrishnan


Loader.
Live Chat Icon For mobile
Up arrow icon