# make an order by or sort by

**URL:** <https://forum.djangoproject.com/t/make-an-order-by-or-sort-by/14002>\
**Category:** Getting Started\
**Created:** [May 29, 2022, 12:19am UTC](https://forum.djangoproject.com/t/make-an-order-by-or-sort-by/14002 "2022-05-29T00:19:01Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![julienbalis](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/julienbalis/32/7402_2.png) [@julienbalis](https://forum.djangoproject.com/u/julienbalis)\
**Post date:** [May 29, 2022, 12:19am UTC](https://forum.djangoproject.com/t/make-an-order-by-or-sort-by/14002/1 "2022-05-29T00:19:01Z")

</div>

how can i make an order by when we clic in the title, bellow the screen for exemple when we clic in the machine title we can order by machine.

 ![image](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/3/370c58f2fc6c44e4fbb8b9190b4216321496e2b3.png)

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 29, 2022, 12:22am UTC](https://forum.djangoproject.com/t/make-an-order-by-or-sort-by/14002/2 "2022-05-29T00:22:21Z")

</div>

Do you want this done by sending a new request to the server to reload the page, or are you looking to do this in the client via JavaScript?

---

<div class="post-metadata">

**Author:** ![julienbalis](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/julienbalis/32/7402_2.png) [@julienbalis](https://forum.djangoproject.com/u/julienbalis)\
**Post date:** [May 29, 2022, 12:25am UTC](https://forum.djangoproject.com/t/make-an-order-by-or-sort-by/14002/3 "2022-05-29T00:25:50Z")

</div>

really i don’t know what is the best solution

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 29, 2022, 12:31am UTC](https://forum.djangoproject.com/t/make-an-order-by-or-sort-by/14002/4 "2022-05-29T00:31:45Z")

</div>

There is no “best”, just tradeoffs between the two.

For example, if you do it server-side, then each sort is going to re-read whatever data is being displayed and so can show updated data each time you select a column. Now, whether or not you consider that “good” is something only you can determine.

(That’s only one example of the type of tradeoffs involved - there are a number of others.)

---

<div class="post-metadata">

**Author:** ![julienbalis](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/julienbalis/32/7402_2.png) [@julienbalis](https://forum.djangoproject.com/u/julienbalis)\
**Post date:** [May 29, 2022, 12:34am UTC](https://forum.djangoproject.com/t/make-an-order-by-or-sort-by/14002/5 "2022-05-29T00:34:07Z")

</div>

for my exemple i need send a new request to the server to get updated data, but how can I do that

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [May 29, 2022, 12:37am UTC](https://forum.djangoproject.com/t/make-an-order-by-or-sort-by/14002/6 "2022-05-29T00:37:03Z")

</div>

One resource when looking for examples or ideas of specific ways to do things is [djangopackages.org](http://djangopackages.org).

In this case, searching for “sort” gives [Django Packages : Sortable ListView](https://djangopackages.org/packages/p/django-sortable-listview/) as one of the solutions.

I have no idea whether this package is specifically useful to you or not, but even if it’s not, you might get some ideas from reading the code and docs for it.

---

<div class="post-metadata">

**Author:** ![julienbalis](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/julienbalis/32/7402_2.png) [@julienbalis](https://forum.djangoproject.com/u/julienbalis)\
**Post date:** [May 29, 2022, 12:38am UTC](https://forum.djangoproject.com/t/make-an-order-by-or-sort-by/14002/7 "2022-05-29T00:38:30Z")

</div>

ok thanks a lot for your help
