This is a migrated thread and some comments may be shown as answers.

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

5 Answers 25 Views
Report a bug
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Don
Top achievements
Rank 1
Don asked on 19 Apr 2014, 11:26 PM
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.


5 Answers, 1 is accepted

Sort by
0
Petyo
Telerik team
answered on 23 Apr 2014, 08:11 AM
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!

 
0
Don
Top achievements
Rank 1
answered on 23 Apr 2014, 10:45 AM
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".
0
Petyo
Telerik team
answered on 28 Apr 2014, 07:34 AM
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!
 
0
Don
Top achievements
Rank 1
answered on 28 Apr 2014, 11:25 AM
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?
0
Petyo
Telerik team
answered on 28 Apr 2014, 02:42 PM
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!
 
Tags
Report a bug
Asked by
Don
Top achievements
Rank 1
Answers by
Petyo
Telerik team
Don
Top achievements
Rank 1
Share this question
or