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 8770649
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T17:35:49+00:00 2026-06-13T17:35:49+00:00

I have an album edit interface based on knockout Album’s object have such structure:

  • 0

I have an album edit interface based on knockout

Album’s object have such structure:

  • album
    • title
    • date
    • artists (array)
      • id
      • title
    • genres (array)
      • id
      • title
    • tracks (array)
      • id
      • title
      • artists (array)
        • id
        • title
      • genres (array)
        • id
        • title

I created a fiddle to show my work and problems with it.

I think that problem is in tracks: ko.observableArray(album.tracks):

var initialData = […];

var AlbumsModel = function(album) {
    var self = this;
    self.albums = ko.observableArray(ko.utils.arrayMap(album, function(album) {
        return {
            title: album.title,
            image: album.image,
            artists: ko.observableArray(album.artists),
            date: album.date,
            genres: ko.observableArray(album.genres),
            composers: ko.observableArray(album.composers),
            lyricists: ko.observableArray(album.lyricists),
            tracks: ko.observableArray(album.tracks)
        }
    }));
            self.lastSavedJson = ko.observable('')
    self.save = function(formElement) {
        self.lastSavedJson(JSON.stringify(ko.toJS(self.albums), null, 2));
    };
};

ko.applyBindings(new AlbumsModel (initialData));

What’s fine:

  • Album’s title binding
  • Album’s genres binding
  • Album’s artists binding

What’s broken:
binding = two-way binding (e.g. while editing song name, tracklist is not updating )

  • Track’s title binding
  • Track’s genres binding
  • Track’s artists binding

What am I doing wrong?

  • 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-13T17:35:50+00:00Added an answer on June 13, 2026 at 5:35 pm

    You are right: the way you’re doing, the tracks attributes (id, title etc.) are not being created as observables, but only as plain javascript primitives.

    I think you have two options:

    1. consider using the ko mapping plugin, which would create everything (all the properties of all the objects in your model) as observable (if that’s the case).
    2. wrap the creation of the tracks property in a function to make each track (and its properties) observable.

    If you choose the first one, take a look at the mapping plugin documentation.

    If you choose the second one, you can change the creation of the tracks property like this:

    tracks: ko.observableArray(ko.utils.arrayMap(album.tracks,
        function(track) {
            return {
                id: track.id,
                title: ko.observable(track.title),
                artists: track.artists,
                date: track.date,
                genres: track.genres,
                composers: track.composers,
                lyricists: track.lyricists,
                lyrics: track.lyrics
            }
        }))
    

    For this second version, I modified your fiddle a little bit to test it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have the following list: ID3_tag = ['Title','Artist','Album','Track'] And I have a file
I have Data.xml: <?xml version=1.0 encoding=utf-8 ?> <data> <album> <slide title=Autum Leaves description=Leaves from
I have saved photos to my customised album in my app using code [library
I have an issue with importing a picture from the Album in Android, because
I have a image folder which contains sub directory for each album of images
I have a ms access database that has one table for each photo album
I have a search engine that searches albums. For each music album, I have
I have a ListView that contains playlists. If the user wants to edit an
I have 3 primary Tables - Picture, Album and Collage . Collage and Album
i have album table and album permission table. album album_id name private (values yes

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.