Override the close() method of a modalView

5 posts, 0 answers
  1. Relez
    Relez avatar
    45 posts
    Member since:
    Jan 2013

    Posted 18 Feb 2013 Link to this post

    Hello everyone, I would like to override the close() function of a modalView. What I need is to do something first before it closes.

    Here is what I am trying to do:

    var modalView = $("#modalview-menu").data("kendoMobileModalView");    
    modalView.close = function () {
      // do something...
      ...
      // then close it.
    }

    Thanks!
  2. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 20 Feb 2013 Link to this post

    Hi Relvis,

    In the next major release, which is scheduled for end of March, we plan to introduce init, open and close events for the Modal View widget.

    Meanwhile you can use the following approach:
    var modalview = $("#modalview-login").data("kendoMobileModalView");
    var closeOrigin = modalview.close;
    modalview.close = function() {
        //do stuff
        closeOrigin.call(m);
    }

    Please note that depending on the implementation, changing the widgets' API may lead to unexpected side effects which is why we do not support such custom solutions.

    Regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Anton
    Anton avatar
    3 posts
    Member since:
    Dec 2012

    Posted 27 Feb 2013 Link to this post

    Hi Alexander -

    In your sample code, what is the 'm' in closeOrigin.call(m)?
    I tried doing this for the show() method of kendoMobileLoader but I'm getting an error when I call the original show().

  5. Alexander Valchev
    Admin
    Alexander Valchev avatar
    2875 posts

    Posted 28 Feb 2013 Link to this post

    Hello Anton,


    Please accept my apology for the inconvenience caused.
    The 'm' is the modalview. The correct code is:
    var modalview = $("#modalview-login").data("kendoMobileModalView");
    var closeOrigin = modalview.close;
    modalview.close = function() {
        //do stuff
        closeOrigin.call(modalview);
    }


    Regards,
    Alexander Valchev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  6. Anton
    Anton avatar
    3 posts
    Member since:
    Dec 2012

    Posted 01 Mar 2013 Link to this post

    Thanks Alexander! No inconvenience caused at all. I wonder why I hadn't thought of using 'modalview' in place of the 'm'.
    Anyway, it's all working now! Thanks a bunch!
Back to Top
Kendo UI is VS 2017 Ready