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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T18:53:39+00:00 2026-06-16T18:53:39+00:00

I have an observable array that contains a nested tree array. Every array item

  • 0

I have an observable array that contains a nested tree array. Every array item has a children property which holds his children entries. When I click on the checkbox I would like to remove the ticked table rows which in turn should also remove the rows which shows the children of the selected item. How can I do this? I have a little example on jsFiddle here

this is my knockout template:

<script id="nodeTmpl" type="text/html">
    <tr>
        <td>
            <input type="checkbox" name="check[]" />
        </td>
        <td data-bind="text: name"></td>
    </tr>
    <!-- ko template: { name: 'nodeTmpl', foreach: nodes } --><!-- /ko -->
</script>

I have to use a table instead of a ul because I’m using bootstrap and so I styled it. Also, I have multiple columns and style divs or ul would not makes sense

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

    Here’s one solution. Since you have a tree structure, every node has a parent with a nodes array (if we also rename root to nodes). With Knockout, you can always access the parent object using $parent and thus access the enclosing array using $parent.nodes.

    <input type="checkbox"
         data-bind="click: function() { $parent.nodes.remove($data); }" />
    

    JsFiddle: http://jsfiddle.net/mbest/5qqWn/3/

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

Sidebar

Related Questions

I have an observable array that holds a list of people and a table
I have a Knockout observable array that I wish to edit from within Javascript
I have an observable array of Services that might be provided by a company
I'm working with an observable array of Parts that contains an observable of Vol.
I have an observable array containing objects (dynamically created) that have themselves observable attributes.
I have a Knockout.JS observable array that is the basis for a list: self.list_elements
So, I have observable array with sites, which is shown via template. If I'll
i have a an observable array in my model that is bind to just
I have the following view model which contains an array of elements function ReservationsViewModel()
I have an observable array with var items= [ {image: /images/image1.jpg }, {image: /images/image2.jpg

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.