search

Home  >  Q&A  >  body text

php - Using yii CListView to do a parallel sorting problem

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

PHPzPHPz2730 days ago972

reply all(2)I'll reply

  • 仅有的幸福

    仅有的幸福2017-06-05 11:09:53

    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

    reply
    0
  • 滿天的星座

    滿天的星座2017-06-05 11:09:53

    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.

    reply
    0
  • Cancelreply