문제

I am attempting to work an existing web app to use Kendo (Mobile) UI widgets. All of the existing javascript code base is contained within AMD modules (RequireJS).

I would like to attach a 'show' event handler to a view, so that the app can request data from the back end, however the data logic is within a module, and cannot be called from the page script (and thus, I can't use Kendo data-event attributes).

I thought that I would be able to to attach an event handler in code like so:

$('#tabstrip-browse').on("show", function(e) {...});

however, the event handler is not called.

Is there a way to do this?

도움이 되었습니까?

해결책

Seems I'm finally able to answer my own question

My issue was that I was trying to use jQuery event binding syntax to bind to the events, however, KendoUI does not expose events in a jQuery friendly/compliant way.

However, there is a way to do this using the KendoUI API

다른 팁

There is no standard 'show' event in javascript or jQuery. You can bind custom events, but you need to also include a way to trigger them.

Here's a trivial example:

// bind the custom event    
$('#element').on('show', function(e) {
  // handle the custom event
});

// trigger the custom event
$('#element').trigger('show');
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top