Skip to main content

Questions tagged [knockout.js]

KnockoutJS is a JavaScript library used for data and event binding on web pages, using a MVVM pattern.

Filter by
Sorted by
Tagged with
7 votes
1 answer
84 views

Monitoring a view model for changes to display a save button

I'm working with Knockout3 in a Chromium 40 environment (ES5). I have a series of preset difficulty options, and a player has an option to switch to custom difficulty and tweak the options. When they ...
Quitch's user avatar
  • 75
4 votes
1 answer
52 views

Performing asynchronous fetch-es that rely on each's response

Code Review : Could promises be 'chained'? I am developing a simple Quote tool for the business-owner to fill in a form (item number, item name, price, etc) and send to the potential customer. This ...
John S.'s user avatar
  • 171
4 votes
0 answers
625 views

Client-side routing using Knockout and HTML5 History API for a single-page web application

The full question is... "Please, how can this code base or project (for client-side routing using Knockout and HTML5 History API) be further enhanced as regards security, production-readiness, ES6, ...
Olumide's user avatar
  • 141
2 votes
0 answers
146 views

Lazy Loading Values to Multiple Arrays

...
ascendantofrain's user avatar
2 votes
0 answers
393 views

Dungeons and Dragons Initiative Tracker

I just started learning JavaScript (and the Knockout framework), and decided to try and make an initiative tracker for Dungeons and Dragons 5th Edition. It is designed to take an arbitrary number of ...
diego's user avatar
  • 121
1 vote
1 answer
55 views

Simplify 2 filters on the same array

I have an array of number objects, which can be selected only if the orderable quantity is greater than 0. I have a select all checkbox that is checked or unchecked accordingly with this function: <...
joc's user avatar
  • 235
2 votes
1 answer
85 views

Optimize KnockoutJs Pagination Computed Function

I have written a function that builds an array of paging options for rendering on the view. I have modelled it after DataTables for jQuery, a live example with lots of data is available here: http://...
Sean Thorburn's user avatar
1 vote
1 answer
1k views

Knockout computed observables in ES6

I am trying out for the first time knockoutjs and babeljs and have a question on how to do computed observables properly. Both fullName and ...
Andre Gallo's user avatar
0 votes
1 answer
1k views

Adding 1 to Date while binding using KnockoutJS

I am using KnockoutJS to bind some values. I have a date value TimeByDay that I bind like this: ...
Jesper Lund Stocholm's user avatar
4 votes
1 answer
371 views

Simple Tic-Tac-Toe App Using Knockout.JS

This is really the first full app I've written in JavaScript minus CSS styling which I plan on adding later. Are there any ways it can be improved? Any ways I can make it cleaner or easier to read? ...
Ron's user avatar
  • 43
1 vote
1 answer
112 views

Customer ViewModel with optional JSON initialization parameter

I have a situation where I have a ViewModel: ...
Dawood Awan's user avatar
0 votes
1 answer
1k views

Display relevant contents if radio button is clicked using knockout.js

I have four radio buttons and I want to display relevant contents for each of them if they are clicked. I am using knockout.js for data binding. Is there a better way to write the if statement block?...
Saeed's user avatar
  • 121
4 votes
1 answer
130 views

UI for adding roles and modules to a user list

I have a small UI that involves adding roles and modules to a user database array. The interface works as is, no problem at all, but it seems to have a bit of 'duplicate' code that I was hoping I ...
ascendantofrain's user avatar
2 votes
0 answers
785 views

Assigning JSON object values to objects in a KnockoutJS setup

I am using this for in loop to loop through a JSON object and to assign the JSON object's value to my own object in a KnockoutJS setup. The JSON object looks like ...
ATWP's user avatar
  • 23
12 votes
1 answer
1k views

Simon Says in Javascript (with Knockout) - Playable Code Snippet

I resolved to do the whole thing with just vanilla Javascript as a challenge, but man, Knockout's binding and state management is just too easy. A tiny bit of callback hell to get all the flashing / ...
Kyle Hale's user avatar
  • 820
2 votes
1 answer
389 views

Intersect knockoutjs observablearray using linqjs

I wrote a extender function to observableArray in knockout js. What I'm looking for is a way to extract the intersection records based on one property. This works well on smaller number of arrays, but ...
Pochen's user avatar
  • 173
18 votes
2 answers
2k views

Custom JavaScript validation using the factory / module patterns

I am in the process of diving a bit deeper into JavaScript development and am looking at some common language patterns (module, and factory in particular). In this code, my aim is to create a re-...
xDaevax's user avatar
  • 1,171
5 votes
2 answers
334 views

Select grand child in array knockout

I'm trying to select a grand child from an array in an array. If it was C# I would have wrote something like below ...
Pochen's user avatar
  • 173
1 vote
1 answer
595 views

Dealing with the need to pass the root view model down to the children

I tend to feel the need in my Knockout applications to pass along a reference of the root view model down to the sub view models. However, I don't like the fact that I then have a dependency that lies ...
Jeroen's user avatar
  • 1,441
2 votes
1 answer
634 views

Custom text binding handler

I created this custom binding handler: ...
Bart Calixto's user avatar
2 votes
0 answers
144 views

Correct usage of an MVC pattern in web applictaion

I have a method in my controller (GetAllPatients/EnrollmentQueue) which does return the correct data (an array of ...
Oleg Dobra's user avatar
4 votes
3 answers
187 views

Planning Poker Using Knockout

I am trying to build something similar to planning poker and am very new to Knockout and was wondering if anyone could help me improve on my very crude start? This is what I have so far: HTML ...
Graham Walsh's user avatar
2 votes
1 answer
224 views

Is this a correct knockout ViewModel setup?

This is my first time using knockout. I'm reading/writing a JSON file with a fair bit of nested data. I had no problem creating the ViewModel to just write to the file, but now that I'm reading the ...
Graham T's user avatar
  • 121
5 votes
1 answer
2k views

Prototype inheritance with Knockout observables

I'm trying to write a JavaScript library to allow inheritance with knockout. The fundamental problem when implementing inheritance in Knockout is that each Knockout observable is its own instance, ...
cwohlman's user avatar
  • 151
3 votes
1 answer
4k views

Revert knockout model original state back on update cancel?

I am using knockout in my project. I have some models like EmployeeModel, ServiceModel etc which user can update. On UI I give ...
Gaurav's user avatar
  • 131
20 votes
3 answers
13k views

Simple to-do list as a single page application

I've been doing a simple implementation of a to-do list to learn how to use Knockout.js. I would like a general review of what I've done so far (not much). It's my first application in JavaScript and ...
Marc-Andre's user avatar
  • 6,711
4 votes
1 answer
2k views

Knockout custom binding

I've written a custom binding for KnockoutJS which renders <select> elements with <optgroup> children. When run, ...
awj's user avatar
  • 141
5 votes
1 answer
1k views

knockout binding handler for custom components

I am using a combination of knockoutJS and jQuery. I have a number of jQuery plugins which perform particular re-usable functions, such as a numeric spinbox. I have written a binding handler to ...
Jamiec's user avatar
  • 163
11 votes
2 answers
4k views

Knockout.js binding 2D table with rowspan

The app I'm working on should allows it's users to create tables. I have a view in which users are able to create a table. They should be able to define here the table's columns. The columns that the ...
Razvan's user avatar
  • 213
2 votes
1 answer
156 views

Structuring objects for proper MVVM in Knockout

I'm working with knockout and am trying to stay true the MVVM structure and trying to make the objects have that dependency on each other. Model, ViewModel, Service definitions: ...
Justin's user avatar
  • 223
2 votes
1 answer
88 views

Need suggestions to improve the code for an open source web based drafting application

My application. The repository and the file that needs review. Here is the source code ...
Akshat Jiwan Sharma's user avatar
5 votes
1 answer
7k views

Two Knockout computed dependent on each other

I have 3 fields: Net Price (ex. tax) tax amount Total price (price ex. vat + tax amount) The NetPrice and the Total are ...
Иван Грозный's user avatar
5 votes
2 answers
1k views

How to enhance the readability of JavaScript part?

There is no doubt that Knockout.js is a very useful tool, which will save you from a lot of JavaScript (jQuery) binding hassle, which will reduce your team's bug ratio concerning this part. But ...
Abdel Hady's user avatar
1 vote
1 answer
401 views

Book catalog demo using Knockout, jQuery, and JSON

I know this is a lot of code, but I'm not looking for any kind of detailed review of the code. I'm just hoping some nice Javascript guru can give it a once over and offer any needed advice for using ...
Adam Rackis's user avatar