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

The Archive Base Latest Questions

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

I have been wrestling for this for a while and I need some help.

  • 0

I have been wrestling for this for a while and I need some help. I have a KO model and view model that I am using to render a view. In this case, the object is a band. this band has an observable array of albums. I just cant work out how to remove an album from the band model.

function band(item) {
    var self = this;
    self.name = ko.observable(item.name);
    self.country = ko.observable(item.country);
    self.state = ko.observable(item.state);
    self.city = ko.observable(item.city);
    self.emailAddress = ko.observable(item.emailAddress);
    self.albums = ko.observableArray(item.albums);
}

function User() {
    var self = this;
    self.bands = ko.observableArray([]);
    self.singleBand = ko.observable();

    //Get Bands from data source and create new models to add to bands array
    $.getJSON("/api/band", function (allData) {       
        $.each(allData, function (index, item) {
            self.bands.push(new band(item));
        });
    });

    //function to get a single band from a rendered list
    self.getThisBand = function (item) {
        self.bands = ko.observableArray(null);
        self.singleBand(item); 
    };

    //remove band from singleBands' album array
    self.removeAlbum = function (albumToDelete) {

        //how to delete album from band model
    };
}

ko.applyBindings(new User());

The logic is pretty simple, I am getting a list of bands and binding them to a list in the UI (no probs). When i click on a bands name in the UI I load the getThisBand method and populate UI (again no prob). I have bound the singleBand.albums array to a list, and that has the femoveAlbum onclick function. The data being passed to the function is the correct object too.

is there something fundamental I am missing?

  • 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-13T02:28:51+00:00Added an answer on June 13, 2026 at 2:28 am

    Looks like self.singleBand() will be equal to the current band, so in your removeAlbum function you can do:

    //remove band from singleBands' album array
    self.removeAlbum = function (albumToDelete) {
        var band = self.singleBand();
        band.albums.remove(albumToDelete);
    };
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been wrestling with this for a while now. I have an app that
I have been wrestling with this problem for quite some time now. I have
I have a complex object hierarchy that I've been wrestling with to get passed
I have been wrestling with this for a few days and after tons of
This is a thought problem, and one I have been wrestling with for about
Have been looking on some tutorials for drawing canvas using SurfaceView, but the only
I have been wrestling with a latex table for far too long. I need
I've been wrestling with this for a few days - I have a custom
Ok so I have been wrestling with this and now thought I ask for
I've been wrestling with this for a while now. I'm not sure MYSQL query

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.