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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:03:10+00:00 2026-06-01T23:03:10+00:00

I can’t figure out how can I access a value which has been updated

  • 0

I can’t figure out how can I access a value which has been updated by checked binding in the method associated with a click binding?

It seems that checked binding evaluates AFTER click binding, since in click binding method/handler I can’t access computed property value which depends on array synchronized with checked binding.

Template for a single check box:

<script id="singleFilterTemplate" type="text/html">
    <li>
        <input type="checkbox" data-bind="attr: { value: id }, 
                                          click: $root.testMethod,
                                          checked: $parent.selectedFilterIds">
    </li>
</script>

I’ve following hierarchy of view models:

- TopLevelViewModel ($root in template above, defines computed aggregatedSelectedIds property)
---- GroupViewModel_0 ($parent in template above)
-------FilterViewModel_0_0 (Each FilterViewModel is associated with a check box)
-------FilterViewModel_0_N 
---- GroupViewModel_N
-------FilterViewModel_N_0 
-------FilterViewModel_N_N 
  • checked: $parent.selectedFilterIds: each time check box has been checked/unchecked – appropriate item in the TopLevelViewModel.selectedFilterIds array is updated
  • click: $root.testMethod: whilst click on a check box I’m trying to grab current state of the all check boxes, for this purposes I’ve introduced computed property aggregatedSelectedIds which works well and represent aggregated state for the all GroupViewModel.selectedFilterIds values, basically it aggregates metadata from the all selectedFilterIds properties into a single value and in testMethod() I’m just calling alert(topLevelViewModel.aggregatedSelectedIds()) to ensure that this property represents a list of currently selected filters.

So each time testMethod() called by click binding – I see previous state of the filters (value, computed by the aggregatedSelectedIds). So is there any way to force/push/evaluate checked binding before click binding? I tried event binding but got the same results. Perhaps I’m doing this in wrong way and missed something obvious?

  • 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-01T23:03:11+00:00Added an answer on June 1, 2026 at 11:03 pm

    You can subscribe to changes to selectedFilterIds by doing

    this.selectedFilterIds  = ko.observable();
    this.selectedFilterIds.subscribe(function (value) {
        //Code from your click method goes here
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I figure out if a function has already been assigned to an event?
Can't figure out how to do this in a pretty way : I have
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a jquery bug and I've been looking for hours now, I can't
Can a LINQ enabled app run on a machine that only has the .NET
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Can't work out a way to make an array of buttons in android. This
Can anyone help me trying to find out why this doesn't work. The brushes
Can we close all known/unknown connections to database with the code? I'm using Access
can anyone help me in trying to check whether JavaScript is enabled in client

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.