Would you be able to post your code thus far, I’d like to have a go at it myself J
Aaron Powell
MVP - Internet Explorer (Development) | Umbraco Core Team Member | FunnelWeb Team Member
http://apowell.me | http://twitter.com/slace | Skype: aaron.l.powell | MSN: aaz...@hotmail.com
I don’t think that Knockout needs to be responsible server-side to generate the HTML, in fact I don’t see it really being that advantageous. My server layer happens to be ASP.Net MVC so I don’t exactly have a server runtime but I can easily create a way to generate the HTML both populated and for templating without having a duplicate code effort.
What Ryan said is correct, I want to use an observableArray as normal so when items are added/ removed from it the UI will be updated to reflect the change, and I want the initial data to be built from the DOM, rather than from JavaScript as it would result in KO doing a rebuild of the DOM after its rendered which to me doesn’t make sense (and the flick between the two modes is a poor user experience).
Aaron Powell
MVP - Internet Explorer (Development) | Umbraco Core Team Member | FunnelWeb Team Member
http://apowell.me | http://twitter.com/slace | Skype: aaron.l.powell | MSN: aaz...@hotmail.com
From: knock...@googlegroups.com [mailto:knock...@googlegroups.com] On Behalf Of Mark Hahn
Sent: Tuesday, 13 September 2011 8:16 AM
To: knock...@googlegroups.com
Subject: Re: Generating a viewModel from the UI
> The only potentially troubling part is generating/maintaining templates on both server and client-side that generate identical content.
I’ve had a play with your sample and it looks good. I do see your point about creating the whole object from the DOM (and the potential to miss data). I’m going to do some experimenting (hopefully) today with it and seeing if we can use this concept in our app J.
Aaron Powell
MVP - Internet Explorer (Development) | Umbraco Core Team Member | FunnelWeb Team Member
http://apowell.me | http://twitter.com/slace | Skype: aaron.l.powell | MSN: aaz...@hotmail.com
From: knock...@googlegroups.com [mailto:knock...@googlegroups.com] On Behalf Of rpn
Sent: Tuesday, 13 September 2011 10:20 AM
To: knock...@googlegroups.com
Subject: Re: Generating a viewModel from the UI
I stand by my sample as a good way to accomplish the original goal. It allows you to associate existing array items with existing DOM elements in a generic way.