knockout.js - Can the Knockout Concurrency plugin track newly added or deleted rows? -


i'm trying use knockout concurrency plugin in project, , i'm fiddling example code, i'm not getting work:

https://github.com/andersmalmgren/knockout.concurrency/wiki/getting-started

viewmodel = function() {     this.name = ko.observable("john").extend({ concurrency: true});         this.children = [{ name: ko.observable("jane").extend({concurrency: true })}, { name: ko.observable("bruce").extend({concurrency: true })}];      this.getdata = function() {         //simulate backend data         var data = { name: "john doe", children: [{ name: "jane doe"},{ name: "bruce wayne"}, { name: "new row"}]};          new ko.concurrency.runner().run(this, data);     } }  ko.applybindings(new viewmodel()); 

http://jsfiddle.net/rcvk4/3/

nothing happens , newly added item not tracked plugin, know why?

thanks trying out plugin, fast too, uploaded code today!

the plugin indeed support tracking of deleted , added rows. know rows needs supply mapper

var mappings = {       children: {         key: function(item) {             return ko.utils.unwrapobservable(item.id);         },         create: function(data) {             return { id: data.id, name: data.name };         }                                 } }; 

the name children corresponds name of array.

the key method used identify property used identifier.

the create method used create new rows (added rows).

you can download mvc3 sample github featured demo, please try out fiddle

http://jsfiddle.net/7atzt/


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -