# |
Dec 6th 2017, 10:50 |
neon1024 |
Otherwise you really only need to worry about the sortWhitelist |
# |
Dec 6th 2017, 10:50 |
neon1024 |
The paginate() method takes an options array which accounts for the default ordering |
# |
Dec 6th 2017, 10:50 |
neon1024 |
So far I see you’ve both hard coded it into your query and into your template |
# |
Dec 6th 2017, 10:49 |
neon1024 |
Then I agree with hmic, you need to stop declaring the ordering everywhere |
# |
Dec 6th 2017, 10:48 |
joopm |
sorting a column |
# |
Dec 6th 2017, 10:45 |
neon1024 |
What is it that you’re actually trying to achieve? |
# |
Dec 6th 2017, 10:39 |
joopm |
almost i have the same issue https://stackoverflow.com/questions/9131404/how-to-change-paginatorhelper-direction |
# |
Dec 6th 2017, 10:34 |
joopm |
what do you suggest how should i do this? |
# |
Dec 6th 2017, 10:34 |
hmic |
moin moin |
# |
Dec 6th 2017, 10:33 |
neon1024 |
Moin hmic! |
# |
Dec 6th 2017, 10:32 |
hmic |
joopm, the paginator created param does not match what you are using IMHO |
# |
Dec 6th 2017, 10:29 |
joopm |
now i the direction does not change |
# |
Dec 6th 2017, 10:29 |
joopm |
without the direction as you sad before |
# |
Dec 6th 2017, 10:29 |
joopm |
in the view i just use <th scope="col"><?= $this->Paginator->sort('People.name',(__('Student'))) ?></th> |
# |
Dec 6th 2017, 10:28 |
joopm |
which has this option: ->order([$this->request->query['sort']=>$this->request->query['direction']]); |
# |
Dec 6th 2017, 10:28 |
joopm |
oky as i said i have a costume find methode |
# |
Dec 6th 2017, 10:25 |
hmic |
i can't magically know the details of what you are doing, sorry. |
# |
Dec 6th 2017, 10:25 |
joopm |
when i click on it it does not change |
# |
Dec 6th 2017, 10:25 |
joopm |
i dont have arrow next to the sort link |
# |
Dec 6th 2017, 10:24 |
joopm |
but not when i have deeper |
# |
Dec 6th 2017, 10:24 |
joopm |
the paginator magic working fine if it is woring with one level association |
# |
Dec 6th 2017, 10:24 |
hmic |
the paginator sort link you've shown does not give you the query param you are using in your order anyways! |
# |
Dec 6th 2017, 10:23 |
hmic |
let the paginator do its magic |
# |
Dec 6th 2017, 10:23 |
hmic |
and you dont need to pass the query param to the sort yourself |
# |
Dec 6th 2017, 10:23 |
hmic |
so you need to click the link 2 times for desc |
# |
Dec 6th 2017, 10:23 |
hmic |
it will toggle |
# |
Dec 6th 2017, 10:22 |
joopm |
okey if i remove the hard code i still only have asc direction |
# |
Dec 6th 2017, 10:22 |
hmic |
if you hardcode it, it will only use this. if not, it is a toggle switch |
# |
Dec 6th 2017, 10:22 |
hmic |
remove the hardcoded value |
# |
Dec 6th 2017, 10:22 |
joopm |
something like rsort in core php |
# |
Dec 6th 2017, 10:20 |
joopm |
how to force to change? |
# |
Dec 6th 2017, 10:20 |
joopm |
does not change |
# |
Dec 6th 2017, 10:20 |
joopm |
if i hard coded in the view ['direction' => 'desc'] than i have desc |
# |
Dec 6th 2017, 10:20 |
joopm |
everytime i have asc |
# |
Dec 6th 2017, 10:19 |
joopm |
->order([$this->request->query['sort']=>$this->request->query['direction']]) |
# |
Dec 6th 2017, 10:19 |
joopm |
thank you for help i have the following in the find method which is base of the paginate: |
# |
Dec 6th 2017, 10:18 |
hmic |
remove the hardcoded direction option from the link |
# |
Dec 6th 2017, 10:18 |
joopm |
doesnt change |
# |
Dec 6th 2017, 10:17 |
joopm |
but it is still remain asc |
# |
Dec 6th 2017, 10:17 |
hmic |
joopm, click the link again |
# |
Dec 6th 2017, 10:12 |
joopm |
i have oposite of the direction after sorting |