Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8577149
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:05:44+00:00 2026-06-11T20:05:44+00:00

I have an observableArray of records which I bind using a template binding. This

  • 0

I have an observableArray of records which I bind using a template binding. This works fine. As I want to keep track of the changes of each of the records, the observableArray consists of observables. This works, too.

What I now want is to convert some of the properties of each record (i.e. of each observable) to a different type.

How should I proceed?

Usually, I could use a computed, but in this case I can not add a single computed observable to the array, as I need multiple of them.

So how do I solve this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T20:05:45+00:00Added an answer on June 11, 2026 at 8:05 pm

    Here is a solution using a view model wrapping each item of the observableArray. And this view model can then contain a computed property.

    var ItemViewModel = function (value) {
        this.value = ko.observable(value);
        this.computedValue = ko.computed(function () {
            return this.value() * 2;        
        }, this);    
    };
    
    var ViewModel = function (list) {
        var self = this;
        self.list = ko.observableArray([]);                
        ko.utils.arrayForEach(list, function (value) {
             self.list.push(new ItemViewModel(value)); 
        });
    };
    
    ko.applyBindings(new ViewModel([1,2,3]));
    
    
    <ul data-bind="foreach: list">
    <li data-bind="text: computedValue"></li>
    </ul>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a template binding to an observableArray <ul data-bind=template: { name: 'defaultTemplate', foreach:
This should be a simple one: I have an observableArray object called To in
have written this little class, which generates a UUID every time an object of
I have a list of attachments on a page which is generated using a
I have an observableArray which I pass through the arrayFilter to return a filtered
I have single grid page and try to bind data using Knockout but I
For example i have such template and i want to calculate some values dynamically
Have just started using Visual Studio Professional's built-in unit testing features, which as I
I have this HTML: <ul class=chat_list data-bind=foreach: chats> <li> <div class=chat_response data-bind=visible: CommentList().length ==
I'm using knockoutjs 2.0 I've been trying to have this table work in IE8

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.