Related
SapuA I'm using the knockout map plugin to add a computed property to an item in an observable array. However, this computed property depends on other properties in my view model. How can I access viewmodel properties when creating an observable during mapping
Allen Rice: I'm still learning the proper usage of Knockout and find myself quickly getting rid of typing ko.observablewhen setting up the view model and just defining an object constant and passing it to the mapping plugin, e.g. var viewModel = ko.mapping.fro
Allen Rice: I'm still learning the proper usage of Knockout and find myself quickly getting rid of typing ko.observablewhen setting up the view model and just defining an object constant and passing it to the mapping plugin, e.g. var viewModel = ko.mapping.fro
Allen Rice: I'm still learning the proper use of Knockout and find myself quickly getting rid of typing ko.observablewhen setting up the view model and just defining an object constant and passing it to the mapping plugin, e.g. var viewModel = ko.mapping.fromJ
Cohen Peters I have a complex culling view model created using the mapping plugin. I also updated the viewmodel with the mapping plugin: ko.mapping.fromJS(json, viewmodel);
I have several subscriptions that use multiple viewmodel fields to calculate results.
JP Hellmons I had almost the exact same problem with Knockout.js - javascript function on data binding, but I used the mapping plugin. Here is my view model and mapping: var viewModel = ko.mapping.fromJS(data);
viewModel.FromUnixTs = function (uts) {
var d
Gildas Tambo I was able to install ko.mapping in Visual Studio , but when I try to map some Json data in the view, it doesn't work. Can anyone tell me what am I doing wrong? this is my view model define(['plugins/router', 'knockout', 'services/logger', 'durand
bear I'm having some problems figuring out why this simple Knockout mapping isn't working. I'm not sure if the returned JSON is invalid, or if my mapping is wrong, or if it's just the binding. The data structure is a parent Conversation object with an array of
name I'm not sure if I understand the workflow that Knockout.js follows internally. I have a ViewModel that is defined dynamically using the mapping plugin. Its shape is: { current: { foo: 'foo', bar: 'bar', id: 0 }
, ids: [1,2,3,4,5]
}
Each idsvalue cor
JP Hellmons I had almost the exact same problem with Knockout.js - javascript function on data binding, but I used the mapping plugin. Here is my view model and mapping: var viewModel = ko.mapping.fromJS(data);
viewModel.FromUnixTs = function (uts) {
var d
Brandon In my Knockout/Sammy SPA, I want to access ViewModel data in Sammy route, however, Sammy route is executed before my Knockout behavior . It works for the initial route because I set it self.selectedPage()equal to the first page, but not for subsequent
Brandon In my Knockout/Sammy SPA, I want to access ViewModel data in Sammy route, however, Sammy route is executed before my Knockout behavior . It works for the initial route because I set it self.selectedPage()equal to the first page, but not for subsequent
Movie Based on the answers to this question , I tried using the following code to get the value before the change in the observable. var phoneBook;
function debug(s) {
$("#log").append('<br>' + s);
}
function PhoneNumber(data) {
var self = this;
self.p
Movie Based on the answers to this question , I tried using the following code to get the value before the change in the observable. var phoneBook;
function debug(s) {
$("#log").append('<br>' + s);
}
function PhoneNumber(data) {
var self = this;
self.p
Varunkumar Manohar Knockout maps cannot handle arrays of objects. Here is my fiddle http://jsfiddle.net/varunfiddle/03rv2the/ Basically, I'm trying to map an array of objects to an array of observables. var ViewModel = function() {
var self = this;
var
ØyvindBråthen I have a viewModel that looks like this after simplification: var viewModel = function(){
var self = this;
self.selectedObject = ko.observable({});
self.getUnit = function(){
//get the selected object from the server side as json
se
ShaneKm I am using the mapping plugin to update the view model like this: $.ajax({
type: "POST",
url: url,
data: data,
contentType: "application/json; charset=utf-8",
dataType: "json",
ShaneKm I am using the mapping plugin to update the view model like this: $.ajax({
type: "POST",
url: url,
data: data,
contentType: "application/json; charset=utf-8",
dataType: "json",
intrinsic I would like to use knockout mapping to map only a given list of properties and no other properties (existing in the model). var propertiesToMap = ["PeriodStartDate", "PeriodEndDate", ...]
knockout.mapping.fromJS(data, {}, myModel)All properties wil
ØyvindBråthen I have a viewModel that looks like this after simplification: var viewModel = function(){
var self = this;
self.selectedObject = ko.observable({});
self.getUnit = function(){
//get the selected object from the server side as json
se
ShaneKm I am using the mapping plugin to update the view model like this: $.ajax({
type: "POST",
url: url,
data: data,
contentType: "application/json; charset=utf-8",
dataType: "json",
Silicon Valley I load my Knockout components this way: ko.components.register("example", {
viewModel: {require: "widgets/example"},
template: {require: "text!widgets/example.html"}
});
with example.js(extremely simplified): "use strict";
define(["kn
Silicon Valley I load my Knockout components this way: ko.components.register("example", {
viewModel: {require: "widgets/example"},
template: {require: "text!widgets/example.html"}
});
with example.js(extremely simplified): "use strict";
define(["kn
Mook This is a question to clarify the best way (or any way!) to achieve this. This may be my way of trying to apply my own .net coding experience to this new way of working, but I can't believe this isn't a real-world problem for many coders. so. The main vie
Silicon Valley I load my Knockout components this way: ko.components.register("example", {
viewModel: {require: "widgets/example"},
template: {require: "text!widgets/example.html"}
});
with example.js(extremely simplified): "use strict";
define(["kn
Zebra Basically, I get an MVC server model, serialize to JSON and pass it to a javascript variable to bind to a table, but nothing happens, I must be missing something. Why not bind it? var categories = [{"Name":"BOOK","ID":"1"},{"Name":"MOVIE","ID":"2"},{"Nam
Zebra Basically, I get an MVC server model, serialize to JSON and pass it to a javascript variable to bind to a table, but nothing happens, I must be missing something. Why not bind it? var categories = [{"Name":"BOOK","ID":"1"},{"Name":"MOVIE","ID":"2"},{"Nam
username I have a working jsfiddle here that is doing what I want so far, which is to list a bunch of contacts (using the map plugin) and extend each "contact" with an additional observable that The (enabled/disabled) state that the observable is used to contr
Sina Saydi I am new to knockout. I am trying to develop a shopping cart functionality using Knockout . My problem is when I want to put a counter in my cart , the counter will be applied to all cart contents. var FoodVM = function() {
self.ID = ko.observable