I receive data from a WCF and bind it to a table. I have been helped in this forum to add some compute fields and everything works perfectly. I’d like to add a total at the footer of this table. a simple version of my page could be seen at http://jsfiddle.net/qeUHd/3/ . Basically I’d like to learn how to add a field to my ViewModel that’s the result of sum of Another field in my sample “Amount”. Any help would be greatly appreciated.
http://jsfiddle.net/qeUHd/3/
I receive data from a WCF and bind it to a table. I have
Share
In your fiddle, you’re mapping your data set to self.model, so self.model is an observableArray. Since that was the case, I just needed to put together a computed value to get your total.
http://jsfiddle.net/qeUHd/5/
Then just make sure to bind to it.
You’re doing things a little backward, but I assume it’s due to the way you’re receiving your data, so I dealt with it and moved on.