ModalView - inconsistent firing of data-xxxx handlers when methods are called

6 posts, 0 answers
  1. Don
    Don avatar
    66 posts
    Member since:
    Jun 2012

    Posted 19 Apr 2014 Link to this post

    According to this thread:  http://www.telerik.com/forums/bug-data-open-handler-not-triggered-when-open-method-is-used-to-show-the-modal-view , it is by design that the data-open event handler is not fired when you call modalview.open() directly.  The admin states:

    "Yes, this decision is by design - the API calls do not trigger events. The reason behind that is that the developer doing the API call would be aware of the open happening, and can call the event handler manually."

    However, if you call modalview.close(), the data-close event handler is fired.  That is inconsistent and very confusing.


    One suggestion is that perhaps if a handler is provided in the method call, it should be used but if not, the data-xxxx handler should be used as a fallback.

    Example A:  If modalview.close() is called, the data-close handler should be used.
    Example B:  If modalview.close(function (e) { ...do stuff... }) is called, then the "...do stuff..." handler should be used.


  2. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 23 Apr 2014 Link to this post

    Hello Donald,

    Thank you for bringing this to our attention. The case in question is quite interesting.

    With the default configuration options, the close method is the only means to close the ModalView - if we follow the open method convention, the close method should not be triggered at all. However, this is not very convenient, so we decided to introduce an exception to the rule for that particular case. 

    The callback suggestion is an interesting one. We will keep it in mind for as a future design change - we will have to propagate it to the other widgets who have similar cases, too.

    Regards,
    Petyo
    Telerik
     

    Share what you think about AppBuilder and Telerik Platform with us in our feedback portal, so we can become even better!

     
  3. Don
    Don avatar
    66 posts
    Member since:
    Jun 2012

    Posted 23 Apr 2014 in reply to Petyo Link to this post

    Thanks for your reply.  I see your point about the .close() call being different.  To further expand on my suggestion, as you know the .open() call works the way I described (somewhat) in that .open(function(e) { ...do stuff... } will actually do "do stuff".
  4. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 28 Apr 2014 Link to this post

    Hello Donald,

    perhaps we are talking about different things then - the ModalView open method currently does not (and has never) accepted a callback. The implementation of the method is here. Please let me know if this is what you mean.

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  5. Don
    Don avatar
    66 posts
    Member since:
    Jun 2012

    Posted 28 Apr 2014 in reply to Petyo Link to this post

    I don't think we're talking about different things?  Please take a look at this:  http://trykendoui.telerik.com/@sweffect/ATUf/6

    I found that syntax on these forums while searching for an answer as to why my ModalView's data-open handler wasn't being fired when making the api call to .open().  I suppose you're saying it's not officially supported and will probably go away in future releases?
  6. Petyo
    Admin
    Petyo avatar
    2439 posts

    Posted 28 Apr 2014 Link to this post

    Hi Donald,

    Ah, I see - it is actually a (very obscure) side effect of this line. The passed function as a document.ready callback (which in this case means immediately). While this works, I would not recommend doing it. you may as well just execute the code without any function right after the open() call. 

    Regards,
    Petyo
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top