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

  • Home
  • SEARCH
  • 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 8699915
In Process

The Archive Base Latest Questions

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

The code is as follows: EmployeeModel is the viewModel and the problem is that

  • 0

The code is as follows: EmployeeModel is the viewModel and the problem is that when I change an item’s property – deletedFlag in employees (obs array), deletedItems is not updated.

How can i fix this?

  function Employee(data) {
    this.employeid = ko.observable(data.employeid);
    this.name = ko.observable(data.name);
    this.isactive = ko.observable(data.isactive);
    this.deletedFlag = ko.observable(false);
}

var EmployeeModel = function () {
    var self = this;
    self.employees = ko.observableArray([]);

    self.deletedItems = ko.computed(function () {
        return ko.utils.arrayFilter(self.employees(), function (item) {
            return item.deletedFlag == true;
        });
    }, this);
}

EDIT: and the following code marks one item from the array for deletion

self.removeEmployee = function (employee) {
        employee.deletedFlag(true);
    };
  • 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:03:50+00:00Added an answer on June 13, 2026 at 2:03 am

    The property deletedFlag is an observable, therefore you need to retrieve its current value by invoking it as a function (you cannot compare it directly to any value):

    self.deletedItems = ko.computed(function () {
        return ko.utils.arrayFilter(self.employees(), function (item) {
            return item.deletedFlag() == true; // <===
        });
    }, this);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting an anonymous class at compile-time that I'm not expecting. Relevant code follows,
I have code as follows: $(#item_select).change(function() { var params = $(#item_select option:selected).val(); $.post('/account/ar_form.php', {idata:
I'm trying to use the google_search ruby library (code follows) but it complains that
I have problem with xhr open() method. My code follows : var xmlhttp=false; if(!xmlhttp)
How do I remove an items from a data bound array? My code follows.
The code follows, i want that whatever data is there in text field T1
Why can't I do something like this in c# (pseudo code follows) Interface1 {
I'm using this plugin: http://www.jeremymartin.name/projects.php?project=kwicks And my code follows this example: http://www.jeremymartin.name/examples/kwicks.php?example=7 I'm using
For some code as follows, opts, args = getopt.getopt(sys.argv[1:], c:, ... for o,v in
I have a piece of javascript code as follows: var data = { ...

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.