how to override function of telerik javascript type at the right time

2 posts, 0 answers
  1. Rafe
    Rafe avatar
    9 posts
    Member since:
    Feb 2014

    Posted 22 Sep 2015 Link to this post

    Greetings, if I want to augment the functionality of one of the Telerik javascript "classes", is there a proper way to override a function such that my change will be applied after the initial Telerik js declarations/file references, but before the $create() function calls which use the classes that are being modified?

    For instance, I'd like to tweak the "initialize" function in the WebServiceRenderingManager class. So at some point after WebServiceRenderingManager is declared by the Telerik js script I want to update the prototype for it: 

    $(function () {
        var $tsr = Telerik.Web.UI.Scheduler.Rendering;
        var $wsrm = $TSR.WebServiceRenderingManager;
        $wsrm.prototype.initialize = function () {
            // my custom code would go here
            $tsr.WebServiceRenderingManager.callBaseMethod(this, 'initialize');

    Is there a standard way/place to include my code above so that it will run after the initial WebServiceRenderingManager prototype is defined, but before the client-side code executes that initializes the control instances ($create(Telerik.Web.UI.RadScheduler, {...});)? Is there a best practice for this? 

    Btw, I only need to do this for a particular aspx page, not globally for my entire site.

    Thanks in advance!


  2. Plamen
    Plamen avatar
    2812 posts

    Posted 25 Sep 2015 Link to this post


    All you need to do is put the code on the page in the script tag as for example in the code below:
    <script type="text/javascript">
        var $ = $telerik.$;
        $TSR = Telerik.Web.UI.Scheduler.Rendering;
        $TSR.WebServiceRenderingManager.prototype.initialize = function() {
            this._isWCFService = this._settings.get_path().endsWith("svc");
            this._isWebApi = this._settings.get_path().startsWith("api");
            $TSR.WebServiceRenderingManager.callBaseMethod(this, 'initialize');

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top