Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Knockout Event's Not working #10

Open
ghost opened this issue Jun 11, 2014 · 2 comments
Open

Knockout Event's Not working #10

ghost opened this issue Jun 11, 2014 · 2 comments
Assignees
Milestone

Comments

@ghost
Copy link

ghost commented Jun 11, 2014

It seems that the knockout events are not working. I have a change event setup to call an ajax function if the value changed but its not working. Any help?

<textarea class="form-control" style="height: 100px; width: 100px;" data-bind="wysiwyg: specificationText, event: { change: $parent.itemChanged }"></textarea>
@michaelpapworth
Copy link
Owner

A good question. I'm certainly happy look into the feasibility of this, since it seems logical to ensure that all events wire up. However, when dealing with the change event specifically you can still achieve this. Take a look at my tutorial on Working with Extensions. You can write an extension that gets called each time the editor changes which in turn calls your function. Something like this;

(function( wysiwyg ) {

    wysiwyg.extensions['mycustomextension'] = function( editor, args, allBindings, bindingContext ) {
        bindingContext.$parent.itemChanged();
    };

})( ko.bindingHandlers['wysiwyg'] );

Hope this helps.

@ghost
Copy link
Author

ghost commented Jun 12, 2014

Thank you this did work!

I have another question. This seems to get called multiple times while clicking into the text-area making my change then clicking out. Anyway to only call this fucntion when the value changed or like on blur or something? I don't see a point of calling it on focus. Thanks for your help.

@michaelpapworth michaelpapworth modified the milestone: 1.2.0 Jun 13, 2014
@michaelpapworth michaelpapworth self-assigned this Jun 13, 2014
@michaelpapworth michaelpapworth modified the milestone: 1.2.0 Jun 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant