Skip to content

Instantly share code, notes, and snippets.

@jimmy-collazos
Created June 27, 2012 09:52
Show Gist options
  • Save jimmy-collazos/3003041 to your computer and use it in GitHub Desktop.
Save jimmy-collazos/3003041 to your computer and use it in GitHub Desktop.
Esta función dispara un evento, asociado a un elemento con jQuery, dentro del control de Telerik; el nombre de evento se pasa como parámetro
<%-- Este ejemplo asocia un evento 'OnGridCreated' para cuando el grid se haya creado --%>
<ClientSettings>
<Scrolling AllowScroll="True" UseStaticHeaders="True" />
<ClientEvents OnRowCreated="" OnGridCreated="shootEventFromTelerik('OnGridCreated')" OnRowContextMenu=""/>
</ClientSettings>
/**
* Esta función dispara un evento dentro del control de Telerik con el nombre del evento que se le pasa como atributo.
* <ClientSettings> <ClientEvents {EventName}="shootEventFromTelerik({EventName})" /> </ClientSettings>
*/
function shootEventFromTelerik(eventName) {
return function (sender, args) {
//console.log(eventName, sender, args) //para cuando no sabes que id tiene el elemento que invoca
//console.log(sender.Control || '#' + sender._clientStateFieldID);
jQuery(sender.Control || '#' + sender._clientStateFieldID).trigger(eventName, [sender, args]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment