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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:27:34+00:00 2026-06-11T11:27:34+00:00

I have a computed array like this, self.weapons = ko.observableArray( [] ); self.wings =

  • 0

I have a computed array like this,

self.weapons = ko.observableArray(
  []
  );

self.wings = ko.observableArray(
  []
  );


 self.itemList = ko.computed( function()
 {
     return self.weapons().concat(self.wings());
 }
 },
 this );

i would like to sort this array.

i can sort ko.observableArray with no problem.

issue here is i think, ko.computed is computes back again after the sorting is done.

also: is there a better way concatenating multiple observableArrays together?

Thank you.

  • 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-11T11:27:35+00:00Added an answer on June 11, 2026 at 11:27 am

    Just sort the concatenated array.

    self.itemList = ko.computed(function () {
        var weapons = self.weapons(),
            wings = self.wings();
        return weapons.concat(wings).sort();
    });
    

    It will have to be resorted every time either array changes but there’s not much you can do about that.

    If you are going to make many changes in succession, consider using the rateLimit extender (or throttle prior to knockout 3.1.x) on your computed observable. This will limit the amount of times notifications are sent out by the observable by collapsing all notifications made within a certain time period.

    self.itemList = ko.computed(function () {
        ...
    }).extend({ rateLimit: 500 }); // wait at least 500ms before first notification
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How would one return a class computed CSS property/property array? Like, if I have
I have a ko.computed() function that proxies a collection like this: function ListView(query) {
I have a loop that goes something like this, where arrayfunction sets all array
I have a multidimensional array like this : $products Smarty_Variable Object (3) ->value =
Problem I have computed a probability density function that depends on two variables. I
I am trying to return a computed element with a computed attribute. I have
I have a cell array like a={'potential'; 'impact'; 'of'; 'stranded'; 'assets'; 'and'; 'other'; 'necessary';
I have a response from remote server like this: /home/computer/Downloads |-- /home/computer/Downloads/Apple | `--
I have an array like the following: people = [{'node': 'john', 'dist': 3}, {'node':
We have some embedded documents that look like this: { _id : ObjectId(4e402353bc9f6ec5a6000001), first_name

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.