Knockout-Kendo Js Databound Event - knockout-kendo

Can anyone tell me why when attaching to the Databound event for any Knockout-Kendo widget, this event always fires twice. Or has anyone else encountered this behavior. Thank you.

Related

Hook into onExecCommand event with TinyMCE 4

I am using TinyMCE 4 but the documentation is terrible. I am trying to provide a live preview of the content in another div (outside of the editor). Right now I am listening to these events:
$(document).on('tinymce:changed tinymce:init', ...)
This is working when text is entered, but it does not trigger when commands are executed (changing existing text to bold for example).
It looks like in TinyMCE 3.x there is an onExecCommand event that does what I want. But I can't find any documentation on how to listen to the global jQuery event like I am doing with with change and init. Does anyone know what event it is firing?
In the migration guide you can find the following example:
// Old event
editor.onInit(editor, args) {
// Custom logic
});
// New event
editor.on('init', function(args) {
// Custom logic
});
So the one problem is to get right event name and the right editor instance :)
The onExecCommand() event becomes 'ExecCommand' in v4.
So adding a handler on command execution should be like this (be sure that editors are already initialized when executing code below):
for (ed_id in tinymce.editors) {
tinymce.editors[ed_id].on('ExecCommand', function(args) {
alert(1);
});
}
For some reason this event fires twice when command is executed. I think you will overcome this issue.
Though this method does not uses jQuery bindings, it works for me and possibly will solve your problem too.
In case this helps anyone else, here is a list of all the events tinymce 4 allows:
http://www.tinymce.com/wiki.php/api4:class.tinymce.Editor

Calling Response.RedirectLocation from within ICallbackEventHandler.RaiseCallbackEvent does nothing

We're attempting to make a redirect during a page callback. We have an aspx page that is implementing ICallbackEventHandler. Inside of the ICallbackEventHandler.RaiseCallbackEvent() event handler in the code-behind we're attempting to use the Response.RedirectLocation to move the user on to another aspx page. Our code is below.
void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
{
HttpContext.Current.Response.RedirectLocation = "http://www.google.com";
HttpContext.Current.Response.End();
}
After raising the event client-side and setting breakpoints in the event handler we are sure that the code is being called but the page doesn't actually redirect. Are we missing something important here? We've tried several other ways including setting the Response.StatusCode and using Flush() instead of End(). Let me know if you need any additional information about what we're trying to do.
Any ideas would be greatly appreciated!
Thanks,
Daniel
I did it without the last line and it works.
HttpContext.Current.Response.RedirectLocation = "http://www.google.com";
The old fashioned way was Response.Redirect(url). Does that fix it?

Trigger the event which happens when I click the 'x' button on a TinyMCE modal dialog (like the advimage dialog)

Please see this comment and the rest of the thread: [question]: TinyMCE Image URL select
Thank you!
The 'x'-Button element is the element you get using $(".mceClose"). So you are able to assign an event handler there (you need to assign the handler when the dialog is open/visible) else you won't find such an element and the assignment will fail. Here it is:
$(".mceClose").click(function() {
alert('Handler for .click() called.');
});

MouseOver and MouseOut events does not get fired by a widget

I have two widgets listening for a MouseOutEvent. Problem is that sometimes this events does not get called on both of the widgeth even if you mouse out of them.
No error is thrown and this is extremely hard to debug.
My understanding is that this event is fired by a browser, so I don't understand why this is not happening. I am registering this event to the widget itself.
Any suggestions will be a great help.
Thanks
Sounds like you might have used addHandler to register to your MouseOverHandler. Widget has two methods for adding event handlers, addDomHandler and addHandler. The first is meant to be used for DomEvents, e.g. MouseOutEvents. It sinks the event on the widget, which means that your listener will get notified (this is only necessary for DomEvents). Those events might not get fired if you do not use addDomHandler to register your handler.

Attach JavaScript event handler to Zend_Form_Element

I need to attach some javascript to the onchange event of the Zend_Form_Element. How do I do that?
Try with setAttrib($name, $value), for example:
$element->setAttrib('onchange', 'jsFunction();');
You can find more detailed information about Zend_Form_Element's here.