knockout.js

Issue loading knockout components view model using requireJS

雨燕双飞 提交于 2019-12-29 07:12:15
问题 I am working with the new components functionality of knockout 3.2 and trying to load the components using requireJS. However, I am having a weird issue. Basically, when I hardcode the view model in the register function everything works fine. When I try to load the exact same view model using requireJS, it's not working correctly. Here's a sample of the html to load the component: <div data-bind="component: { name: 'test'}"></div> Here's the html in the template that this component will load

Knockoutjs select with option group

落花浮王杯 提交于 2019-12-29 06:43:05
问题 Is there any way in Knockoutjs binding where I can specify optionsGroup ? something like follwoing <select data-bind="options: collection, optionsText: 'Text', optionsGroup: 'Group'/> Please do reply. 回答1: I got the answer of the same, here is the answer if anybody wants, <td><select class="fieldValue" data-bind="foreach: $root.AvailableFields, value: FieldId, event :{ change: $root.onFieldSelectionChange}"> <optgroup data-bind="attr: {label: FieldGroupName}, foreach: Fields"> <option data

Manually get knockout to re-evaluate a dependantObservable

ⅰ亾dé卋堺 提交于 2019-12-29 04:29:08
问题 I am not sure if this is possible, but I have a scenario where I have a validation system which notifies my validation system when something has become valid/invalid via a dependant observable. Now this works great when a user is filling out a form as the dependantObservable is driven off the underlying observables value changing. (i.e if the Name property changes, it will re-evaluate the isValid dependant observable, which will in turn notify my binding which hooks into the validation system

What is the best way to hide the screen while knockout js bindings are being built?

浪子不回头ぞ 提交于 2019-12-29 02:33:11
问题 I'm a huge knockoutjs fan. I use it for all my web development now and simply love it. One thing that I've not been able to figure out though is how to hide the UI while the knockoutjs bindings are being built. For example, I have a very robust user interface with lots of templates being used on my page. The problem that I'm noticing is that when the user first visits the page, they see all of my templates for a split second before the bindings kick in and hide them. What is the best way to

Kendo UI datepicker incompatible with Chrome 56

扶醉桌前 提交于 2019-12-28 03:50:06
问题 After updating Chrome to its last version 56.0.2924.76 (64-bit), our Kendo datepickers started not to work properly. All datepickers were binded using ViewModels, and now they don't show their values. If we inspect them we see the value is set, but it's not been shown. For example: @(Html.Kendo().DatePicker() .Name("DateFrom") .Start(CalendarView.Month) .Depth(CalendarView.Month) .Format("MM/dd/yyyy") .HtmlAttributes(new { @id = "ClosingStartDate", @placeholder = "enter date from", @class =

knockout.js: update bindings?

和自甴很熟 提交于 2019-12-28 03:39:09
问题 when I inject any new elements into the DOM after ko.applyBindings(); was called, then knockout won't recognize these new elements. I can understand why this is happening - they are just not indexed by knockout. So, at first I thought this would be solved by just calling ko.applyBindings() again, after adding my new elements, BUT then I realized that for every ko.applyBindings() call you make, the according events get fired multiple times. So after applying five times, a click: binding will

Twitter bootstrap 3 Modal with knockout

旧时模样 提交于 2019-12-28 02:51:11
问题 I am trying to fully bind twitter bootstrap modal with knockout. By fully bind I mean that I want every close interaction with modal dialog to work with knockout. I have seen some of the questions, which partially bind them (for example this one does not allow esc). I am using almost identical binding (which I actually found elsewhere) ko.bindingHandlers.modal = { init: function (element, valueAccessor) { $(element).modal({ show: false }); }, update: function (element, valueAccessor) { var

Prevent event bubbling when using the checked binding in knockoutjs

[亡魂溺海] 提交于 2019-12-28 02:06:30
问题 I'm building a UI using KnockoutJs and Twitter Bootstrap. I'm using the checked binding inside a Bootstrap dialogue called dropdown-toggle . <div class="btn-group"> <a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> Facets <span class="caret"></span> </a> <ul class="dropdown-menu"> <!-- ko foreach: facets --> <li> <input type="checkbox" data-bind="checked: Visible" /> <span data-bind="text: Name"></span> </li> <!-- /ko --> </ul> </div> Everything is fine except that I would like

integrating jquery ui dialog with knockoutjs

戏子无情 提交于 2019-12-27 11:43:32
问题 I am trying to create knockoutjs bindings for jquery ui dialogs, and cannot get the dialog to open. The dialog element is created correctly, but seems to have display: none that calling dialog('open') doesn't remove. Also, the call to dialog('isOpen') returns the dialog object rather than a boolean. I am using the latest knockoutjs and jquery 1.4.4 with jquery ui 1.8.7. I've also tried it with jQuery 1.7.1 with the same results. Here's my HTML: <h1 class="header" data-bind="text: label"></h1>

integrating jquery ui dialog with knockoutjs

孤者浪人 提交于 2019-12-27 11:39:33
问题 I am trying to create knockoutjs bindings for jquery ui dialogs, and cannot get the dialog to open. The dialog element is created correctly, but seems to have display: none that calling dialog('open') doesn't remove. Also, the call to dialog('isOpen') returns the dialog object rather than a boolean. I am using the latest knockoutjs and jquery 1.4.4 with jquery ui 1.8.7. I've also tried it with jQuery 1.7.1 with the same results. Here's my HTML: <h1 class="header" data-bind="text: label"></h1>