jQuery UI Widgets › Forums › Editors › NumberInput › jqxknockout data binding does not work
Tagged: jqxknockout data-bind
This topic contains 6 replies, has 2 voices, and was last updated by richardjansen 10 years, 5 months ago.
-
Author
-
Hello,
I try to use jqxknockout, but with no success. Below is my code snippet. What do I miss here?
// with RequireJS: 'knockout', // is named 'ko' below 'jqx/jqxnumberinput', // the widget to show 'jqx/jqxknockout' // I need this for knockout data binding. It is successfully loaded using RequireJS viewModel = function() { this.foo = ko.observable(3); } ko.applyBindings(); // This works, see the span below // html This does work. It shows '3' in a span: <span data-bind="text: foo"></span> // This does not work: It shows 'Place widget in here!'. No widget is rendered. <div data-bind="jqxNumberInput: {value: foo, width: 40, height: 25}">Place widget in here!</div>
Thanks
RichardHello Richard,
Working sample: http://www.jqwidgets.com/jquery-widgets-demo/demos/jqxknockout/numberinput.htm?arctic
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hello Peter
I know that sample. The problem seems to be requireJS. When not using requireJS and place the scripts in the head, it works. But if I use requireJS (my whole project is build on top of it) the sample won’t work. Is this an known issue and can it be solved? I also notice the very old versions of Jquery and Knockout.
Cheers,
RichardHi Richard,
jQuery 1.11.1 is the jQuery’s Latest version. I do not know why you assume that it is very old.
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.com/Hi Peter
jQuery 1.11.1 is actually the same as 2.11.1 but without IE 678 support, I understand now. But my problem is still standing. What about the usage of RequireJS in combination with jqxknockout data binding?
Cheers
RichardHi Richard,
We have a help topic about RequireJS with KnockoutJS – http://www.jqwidgets.com/jquery-widgets-documentation/documentation/requirejs/requirejs_tutorial_knockout.htm
Best Regards,
Peter StoevjQWidgets Team
http://www.jqwidgets.comHi Peter
Thanks. I didn’t noticed that tutorial. I had only had to add one line before ko.applyBinding().
window.ko = ko;
Unfortunately my viewmodel doesn’t update when entering a new value in the widget. I have to figure it out.Richard
-
AuthorPosts
You must be logged in to reply to this topic.