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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T11:42:28+00:00 2026-05-29T11:42:28+00:00

Animated transitions on templates with knockoutjs work really well if you are adding or

  • 0

Animated transitions on templates with knockoutjs work really well if you are adding or removing an element form an observableArray. but how would i capture an update.

Currently for updating an item I am simply replacing an item in the array like so:

var index = arrayFirstIndexOf(self.documents(), function (item) { return item.id === doc.Id });
self.documents.replace(self.documents()[index], new Document(doc.Id, doc.Title, doc.Content))

animated transition will see this as a remove and an insert. How would i distinguish an update?

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-05-29T11:42:31+00:00Added an answer on May 29, 2026 at 11:42 am

    so here is a solution using custom bindings

    instead of using a replace:

    var index = arrayFirstIndexOf(self.documents(), function (item) { return item.id === doc.Id });
    self.documents()[index].title(doc.Title).content(doc.Content);
    

    This works well for a simple object. But a larger object may be better to use the mapping plugin. the point is, i am no longer replacing the array item hence the “addAfter” and “beforeRemove” template transition are not being fired.

    The title and content properties are observable objects. So to handle the transition of an Update of an array item i use a custom binding that looks like:

       ko.bindingHandlers.highlightChange = {
           origValue : null,
           init: function (element, valueAccessor) {
               origValue = valueAccessor();
           },
           update: function (element, valueAccessor) {
               if (origValue !== valueAccessor())
               {
                   $(element).hide().fadeIn("slow");
               }
           }
       };
    

    this then compares the original value and against the updated.
    If anyone has a better solution i would really appreciate you post it here.

    cheers.

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

Sidebar

Related Questions

I would like to display an animated gif on a .NET Compact Form .
NavigationControllers have ViewController stacks to manage, and limited animation transitions. Adding a view controller
Simple enough question: Is it possible to leverage css transitions when it would would
I'm using Cocos2d for all the animated sprite/transition stuff, but I'm not sure how
I have in mind one simple application, but I would like to add some
I'm in the coding Objective-C of xcode4.2. But stopped working on an animated navigation
Animated PNG images (APNG) have been around for quite a while in an attempt
In a fairly animated discussion in my team I was made to think what
I have imported an animated GIF as a resource into a picturebox - unfortunitly
I have an animated gif placed on the button. It's animating ok (most of

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.