Вопрос

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