php - Using yii CListView to do a parallel sorting problem
PHPz2017-06-05 11:07:53
0
2
970
I want to make a page ranking function. Now the page ranking is successful, but the scores are the same and they cannot be ranked side by side. Please give me some advice. Masters
I thought hard for an hour and used a relatively clever way to solve this problem Don’t touch the original logic, then query it again, sort it in the controller alone, and then pass the value in according to the viewData of CListView. The component loops and then maps the sorting to the template
If it is like this: 10, 11, 11, 11, 12, 13... Such a transformation is really troublesome after thinking about it. I feel that I can only take out all the data, traverse and re-rank it, and then paginate. Maybe CArrayDataProvider needs to be used to provide data to CList. If it is other: 10, 11, 11, 11, 14, 15... It is relatively simple to just take out the page and re-traverse the rankings in this page.
I thought hard for an hour and used a relatively clever way to solve this problem
Don’t touch the original logic, then query it again, sort it in the controller alone, and then pass the value in according to the viewData of CListView. The component loops and then maps the sorting to the template
If it is like this: 10, 11, 11, 11, 12, 13... Such a transformation is really troublesome after thinking about it. I feel that I can only take out all the data, traverse and re-rank it, and then paginate. Maybe CArrayDataProvider needs to be used to provide data to CList.
If it is other: 10, 11, 11, 11, 14, 15... It is relatively simple to just take out the page and re-traverse the rankings in this page.