V
V
voe2015-11-12 23:05:54
JavaScript
voe, 2015-11-12 23:05:54

How to implement data sorting and data filtering on the client side?

For pagination, the kaminari gem is used, I
tried to implement sorting as described here - railscasts.com/episodes/240-search-sort-paginate-w... but there is a request to the database, which, as it were, is not particularly correct in terms of load on DB. (cache on the server side is not used)
I would like to sort without the participation of the database and without caching (at the moment it is simply not implemented in the application)

Answer the question

In order to leave comments, you need to log in

4 answer(s)
N
N. Bekseitov, 2015-11-13
@nbekseitov

Use AngularJS.
Example

S
Stanislav German, 2015-11-14
@StGerman

If you need sorting and/or a quick way to search and filter data, then it's better to use ransack

R
Roman Mirilaczvili, 2015-11-15
@2ord

AJAX -> get JSON -> render HTML.
It is only necessary with the help of JS and templates.
The user is once given HTML with a complete layout and a ready-made target view template inside the layout itself, directly using inline insertion. Then, when the entire DOM is loaded, AJAX is called to get the raw data, based on which the target code is built using the template. All this with jsRender (~17 KB).
It is possible without AJAX. Then the raw data needs to be received inside the inline JS code along with the HTML.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question