Skip to content
Advertisement

Tag: knockout.js

Knockout JS – make observable dynamically modified object

Is possible to make dynamically changed JS object as a Knockout JS observable? I mean I have this.statuses = ko.observable({}) and when I call API and get response, I’ll put the message here under some “identifiers”. Later I need to get any “last” status if necessary: and in the html template something like: I hope this is understandable, but if

set knockout.js value programatically from “outside”

I am brand new to knockout.js – I have taken over an existing app written in it, the previous maintainers having left – and I want to start by writing tests that exercise the whole thing from outside it. Most pages are quite straightforward, but I’ve encountered this: this is inside a with, inside loops inside another with etc –

Unable to define this context in document.eventListener

I am implementing a scenario in which on clicking outside the drawer, i want to execute the saveChange action but somehow it is giving me the error that saveChange is not a function. I tried different ways to set the context but it is not working. Error : Answer this is because in your event listener, this refers to the

selected option is not updated when observable updates, though optionsValue does

In the following code, a product (represented with productVM) has an observable property (productName) containing its name in two languages (english and french). Once a cartItem is added, and a product is selected, I want its displayed name to be updated when the button “change language” is clicked (e.g., if “Door” is selected, and “change language” is then clicked, the

Bootstrap multiselect blur event not triggering

I’m trying to do some logic after user completes a selection and moves away from a bootstrap multi-select dropdown. I tried hooking into the blur event: Defining a onBlur function in my viewModel: But it never kicks-in. I even tried setting the event binding directly without the $root.onBlur, just blur: onBlur but didn’t work. Here is a sample JS fiddle:

Advertisement