Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Knockoutjs - Sorting a large observablearray

Tags:

knockout.js

I have a knockout model defined on a page with an observable array. I would like to have buttons to sort the array by different properties, I have a 'working' solution but it is extremely slow for large arrays.

jsFiddle - http://jsfiddle.net/7JNrc/

What is the most efficient way to sort a knockout observable array of objects by specific properties?

like image 661
user1573618 Avatar asked Aug 26 '26 11:08

user1573618


1 Answers

Your solution is slow not due to the sorting. It is slow because you bind a lot of items to one page. It takes much time to render 200 items. Moreover your solution is not user friendly. It is very uncomfortable to work with big list without pagination and searching.

So my advice is to use pagination in your list. In this case you will not have any performance issues.

Here is an example of simple client side pagination: Client-Side Pagination

like image 82
Artem Vyshniakov Avatar answered Aug 30 '26 19:08

Artem Vyshniakov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!