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

learn more… | top users | synonyms

1
vote
0answers
25 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://...
1
vote
1answer
296 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 ...
0
votes
1answer
117 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: ...
1
vote
0answers
63 views

Knockout after-school implementation

Please provide some feedback. Example Repository JavaScript ...
4
votes
1answer
158 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? ...
1
vote
1answer
90 views

Customer ViewModel with optional JSON initialization parameter

I have a situation where I have a ViewModel: ...
0
votes
1answer
259 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?...
4
votes
1answer
106 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 ...
2
votes
0answers
334 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 ...
12
votes
1answer
858 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 / ...
2
votes
1answer
209 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 ...
17
votes
2answers
949 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-...
5
votes
2answers
184 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 ...
1
vote
1answer
210 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 ...
2
votes
1answer
296 views

Custom text binding handler

I created this custom binding handler: ...
2
votes
0answers
136 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 ...
3
votes
3answers
86 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 ...
2
votes
1answer
168 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 ...
5
votes
1answer
1k 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, ...
2
votes
1answer
2k 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 ...
18
votes
3answers
10k 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 ...
4
votes
1answer
2k views

Knockout custom binding

I've written a custom binding for KnockoutJS which renders <select> elements with <optgroup> children. When run, ...
4
votes
1answer
873 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 ...
11
votes
2answers
3k 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 ...
2
votes
1answer
117 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: ...
2
votes
1answer
76 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 ...
4
votes
1answer
4k 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 ...
5
votes
2answers
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 ...
1
vote
1answer
359 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 ...