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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T18:14:51+00:00 2026-06-05T18:14:51+00:00

I am using knockout and have an array Properties and each Property can have

  • 0

I am using knockout and have an array “Properties” and each “Property” can have child “properties”

all is fine except that there is a property of the array “TabID” that should be inherited – for example if it is changed on the parent “Property” it should also change on the child “Property”

I’ve tried to get this to work by using creating a computed, eg.

this.TabID = ko.computed(function(){
return $parent.TabID();
});

and then realised that $parent was only available within the foreach loop

I’ve also tried passing the parent through to in the constructor eg

var childproperty = function(parent,[other properties]){
this.TabID = ko.computed(function(){
return parent.TabID(); // OR return parent.TabID;
}

could somebody point me in the right direction please? As a side note I also need to be able access the parent for a zero based [i] caclulation

that is each parent property should be properties[i].propitem where i = a computed value based on each parent + their child properties

for example: if parent property 1 has 3 child properties, then parent property 1 should be i=0, childproperties (i=1,2,3) and then parent property 2 would have an “i” of 4

I know… I don’t ask for much right, I’m not expecting a perfect solution for my issues but if somebody can at least point me in the right direction I would be very grateful.

Cheers.

  • 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-05T18:14:53+00:00Added an answer on June 5, 2026 at 6:14 pm

    I’ve managed to get this working by using the following, hopefully this will help anybody else experiencing the same issue

    var childproperty = function(parent,[other properties]){
    this.parent = ko.observable(parent);
    this.TabID = ko.computed(function(){
    return this.parent().TabID(); // OR return parent.TabID;
    }
    

    I also noticed that because my parent was calling adding the child from within a function i couldn’t just use “this”

    my parent property is now

    var parentproperty = function([properties]){
    var p = this;
    p.childproperties = ko.observableArray();
    p.TabId = ko.observable(1);
    p.addChild = function(){
    p.childproperties.push(new childproperty(p,[other properties]));
    }
    

    this works perfectly – if the parent tabid is changed, the value is reflected by the child property. I only really needed the parent index inside the foreach loop which I accessed with $parentContext.$index()

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

Sidebar

Related Questions

I'm using Knockout with jQuery and jQuery templates. Assume that I have a template
Using knockout.js, is it possible to bind to a property of a child object
I have an ASP.NET MVC 3 view using Razor and Knockout.js that is not
I have a Knockout observable array that I wish to edit from within Javascript
I have run into a strange issue when using Knockout to represent a parent/child
I just started using knockout.js and it works great with normal bidings. I have
I am trying to setup generic Knockout templates that can be toggled between edit
I'm trying to build some HTML with Knockout that Jquery UI can turn into
Using android 2.3.3, I have a background Service which has a socket connection. There's
I am using Knockout Js for my view page. I have a requirement where

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.