knockout.js

Why does a function in a child view model causes a function in the parent view model to fire?

我是研究僧i 提交于 2019-12-20 03:55:10
问题 This is a follow-up question to this one: On the following code, func is a simple function that's bounded to a parent div . Naturally, it fires when document loads, but it also fires when the button is pressed. As explained on the answer to the linked question, I thought this can happen only if func would have been a computed (since it's value is recomputed whenever any of the observables it depends on is changed), but I now see it happens with a simple function. Why? var MasterViewModel =

Knockout JS mapping plugin confusion

六月ゝ 毕业季﹏ 提交于 2019-12-20 03:43:24
问题 I'm confused as to when and where I should declare my viewModel when using the mapping plugin. Here's my json file: { "members": [ { "memberid": "001", "membername": "Jason" }, { "memberid": "002", "membername": "Bob" } ] } Here's the html template: <div data-bind="foreach: members"> <h3 data-bind="text: memberid"></h3> <p>Name: <span data-bind="text: membername"></span></p> </div> Here is the rest: var data = $.getJSON("members.json",function(data) { var viewModel = ko.mapping.fromJSON(data)

What order are knockout js observable extensions executed?

∥☆過路亽.° 提交于 2019-12-20 03:41:42
问题 At the bottom of the knockoutjs docs for extending observables it states... More than one extender can be applied in a single call to the .extend method of an observable. this.firstName = ko.observable(first).extend({ required: "Please enter a first name", logChange: "first name" }); In this case, both the required and logChange extenders would be executed against our observable. ... I want to know what order the extensions will be executed in. Will it always execute in the same order? What

What order are knockout js observable extensions executed?

社会主义新天地 提交于 2019-12-20 03:41:31
问题 At the bottom of the knockoutjs docs for extending observables it states... More than one extender can be applied in a single call to the .extend method of an observable. this.firstName = ko.observable(first).extend({ required: "Please enter a first name", logChange: "first name" }); In this case, both the required and logChange extenders would be executed against our observable. ... I want to know what order the extensions will be executed in. Will it always execute in the same order? What

Use knockout to hide/display questions based on selected value in drop down

爱⌒轻易说出口 提交于 2019-12-20 03:08:17
问题 OK, I am a noob with knockout. Having trouble figuring out a really simple issue. I have a drop down list tied to a knockout observableArray. Also have a list of questions tied to another observableArray. The questions should hide/show based on the selected value of the drop down. BEFORE YOU LOOK AT THE FIDDLE, PLEASE READ THE FOLLOWING. I have hard coded the "EnvId() === 1" just to make it work. I have tried all kinds of functions and ko.computed (in both the "question" and the "viewModel")

Controlling Flash Plugins with Knockout.js, Conflicting jQuery.tmpl and Knockout-Sortable

谁说我不能喝 提交于 2019-12-20 03:00:56
问题 I'm trying to render HTML for embedding Flash objects using Knockout.js' native templating faculties. jQuery.tmpl does the job perfectly well, however I cannot use it due to conflicts with the Knockout-sortable plugin. Here's an example of flash plugins quirking with the native templating: http://jsfiddle.net/7y3ub/35/ In Chrome, the player just never shows up. In Firefox, the player will show up if you change the channel while the checkbox is checked. Rechecking the box however makes the

Using KnockoutJS with multiple pages

纵饮孤独 提交于 2019-12-20 01:16:06
问题 I'm just getting started with learning KnockoutJS. One thing that I'm confused about, the samples seemed to all be focused on a single view with a single viewmodel. How do things work with a larger application? I am going to be writing a pure html/jquery application. All data is served up as json via ajax. There is a common navigation header at the top of the application with multiple tabs and subtabs implemented with Twitter Bootstrap. If I build each page of the application as a separate

How to tie together ko.validation errors with related viewmodel field names

馋奶兔 提交于 2019-12-19 17:37:53
问题 I'm using Knockout.Validation and I'd like to be able to display an error summary where each line displays the error message (obviously!) and also the field name on the view model related to it, e.g. Age - please enter a number Date of birth - please enter a proper date So far I've got a validatedObservable wrapping my view model, and this puts an errors array on my viewmodel automatically, containing all my errors. However I can't see any easy way to retrieve which field each error relates

Excel VBA controls Webpage with Knockout; appears to work; but nothing is saved

删除回忆录丶 提交于 2019-12-19 16:51:11
问题 Summary: Basically trying to edit a website with Excel VBA. The edits appear to work, but when I use the save button, nothing is saved. I know the save button works, explained below. So why isn't my updated data, which is visible on the screen being saved? The story: I have this code I have been working on for awhile with Excel VBA. It opens a webpage in internet explorer, navigates where I want, fills out a bunch of data, all which show up on the screen, using various methods, such as: For

knockoutjs container less template inside SELECT, foreach OPTION not working with Internet Explorer

主宰稳场 提交于 2019-12-19 11:39:11
问题 I have an quiz/survey application and I'm having problems populating a dropdown list using knockoutjs. Please check this fiddle with Firefox (or Chrome), then try it with Internet Explorer 9 (or IE8, or IE7... knockout says to be compatible from IE6+ but obviously IE gives some problems in my scenario). In Firefox and Chrome my jsfiddle example works , but not with Internet Explorer. See in thab 1, last question "Where do you live?" and in tab 2, "Favorite sport?". The dropdown is not