Answer the question
In order to leave comments, you need to log in
How to generate a link to sort only ASC or DESC in dataProvider?
Hello. please tell me if I can generate 2 links using dataProvider, which I will sort only in one or the other direction. Now it looks like this:
And it works on the principle of pressing once - ASC, pressing a second time - DESC.
Can I somehow make it so that I have 2 links, each of which implements sorting in one direction only?
Thanks in advance to all who respond. $dataProvider->sort->link('id');
Answer the question
In order to leave comments, you need to log in
Good evening.
I think that this is unlikely to happen.
You need to define your class, create your own sorter.
It is possible to do so, inherit yii\widgets\LinkSorter and override its renderSortLinks() method . By default, ul is generated, I think that it can be converted to links.
Connect your sorter class.
ListView::widget([
'sorter' => [
'class' => CustomLinkSorter::class,
],
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question