# CakePHP table sorting problem

**URL:** <https://discourse.cakephp.org/t/cakephp-table-sorting-problem/635>\
**Category:** Need Help\
**Created:** [June 27, 2016, 10:54am UTC](https://discourse.cakephp.org/t/cakephp-table-sorting-problem/635 "2016-06-27T10:54:58Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![sahil-chadha](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@sahil-chadha](https://discourse.cakephp.org/u/sahil-chadha)\
**Post date:** [June 27, 2016, 10:54am UTC](https://discourse.cakephp.org/t/cakephp-table-sorting-problem/635/1 "2016-06-27T10:54:58Z")

</div>

Hello friends,  
I am trying to sort the data in one table in view file by using Paginator component and helper. But the data in a table comes by filtering by using ajax, so when I click on sort link it sorts according to all the data in database table, I want to sort the data only present in a html table after filtering. Please guide on the same problem. Many thanks in advance.

Regards,  
Sahil

---

<div class="post-metadata">

**Author:** ![ali](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/ali/32/123_2.png) [@ali](https://discourse.cakephp.org/u/ali)\
**Post date:** [June 27, 2016, 10:43pm UTC](https://discourse.cakephp.org/t/cakephp-table-sorting-problem/635/2 "2016-06-27T22:43:29Z")

</div>

I believe what you’re looking for is sorting on the client side, which has to be done via Javascript.

You can use a jQuery Plugin like this for this purpose: [https://datatables.net/](https://datatables.net/)

---

<div class="post-metadata">

**Author:** ![sahil-chadha](https://avatars.discourse-cdn.com/v4/letter/s/b5a626/32.png) [@sahil-chadha](https://discourse.cakephp.org/u/sahil-chadha)\
**Post date:** [July 7, 2016, 10:34am UTC](https://discourse.cakephp.org/t/cakephp-table-sorting-problem/635/3 "2016-07-07T10:34:25Z")

</div>

Thanks @ali , I had tried this, but I have custom filters on the page, when I use the filter then data table’s design breaks

---

<div class="post-metadata">

**Author:** ![ttorres](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/ttorres/32/263_2.png) [@ttorres](https://discourse.cakephp.org/u/ttorres)\
**Post date:** [July 13, 2016, 3:27am UTC](https://discourse.cakephp.org/t/cakephp-table-sorting-problem/635/4 "2016-07-13T03:27:25Z")

</div>

Hi sahil-chadha,

@ali is correct this would need to be done using javascript. The CakePHP paginator component on the front end is simply a hyperlink in the form /controller/action/?soft-conditions. Javascript operations shouldn’t have any effect on this. Can you upload a code sample of what your doing to sort the html table?

---

<div class="post-metadata">

**Author:** ![yadavn205](https://avatars.discourse-cdn.com/v4/letter/y/e47774/32.png) [@yadavn205](https://discourse.cakephp.org/u/yadavn205)\
**Post date:** [July 15, 2016, 4:18am UTC](https://discourse.cakephp.org/t/cakephp-table-sorting-problem/635/5 "2016-07-15T04:18:25Z")

</div>

Missing Database Table in cakephp so please help  
i am learn cokephp .

---

<div class="post-metadata">

**Author:** ![ttorres](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/ttorres/32/263_2.png) [@ttorres](https://discourse.cakephp.org/u/ttorres)\
**Post date:** [July 16, 2016, 6:46pm UTC](https://discourse.cakephp.org/t/cakephp-table-sorting-problem/635/6 "2016-07-16T18:46:31Z")

</div>

Hi @yadavn205,

What exactly are you missing? Is this related to this current thread? If not please open a new one.

If your starting out I recommend completing the tutorial [here](http://book.cakephp.org/3.0/en/tutorials-and-examples.html)

---

<div class="post-metadata">

**Author:** ![JagiYadav](https://avatars.discourse-cdn.com/v4/letter/j/e47774/32.png) [@JagiYadav](https://discourse.cakephp.org/u/JagiYadav)\
**Post date:** [November 7, 2016, 10:45am UTC](https://discourse.cakephp.org/t/cakephp-table-sorting-problem/635/7 "2016-11-07T10:45:31Z")

</div>

Have you resolved this issue ? I am also facing this issues, I have clear tmp/cache all folder, clear browser cache many times, created I thing new again again but could not solved, so tell me have you resolved this issues, My cakephp versionis 1.2.1
