4

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?

GrantDG
  • 401
  • 1
  • 7
  • 14

3 Answers3

5

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

GrantDG
  • 401
  • 1
  • 7
  • 14
0

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');
Brett
  • 4,268
  • 1
  • 13
  • 28
  • the question was specifically about KendoUI - it seems that Kendo does not expose a public 'show' event (tho it is accessible via it's 'unobtrusive' attributes)... I'm not sure you've understood the question – GrantDG Aug 23 '13 at 06:09
  • Seems to me you're asking how to bind a non-standard event to a view. That's not Kendo specific. Are you asking how to expose it through a view-model and bind it using Kendo? Are you using Durandal? You don't give enough information. – Brett Aug 23 '13 at 12:29
0

There is an attach event on Durandal https://groups.google.com/forum/#!topic/durandaljs/UQ9hXpwP_ds

napoleonss
  • 1,139
  • 13
  • 19