doushengyou2617 2017-04-10 16:31
浏览 44

通过yii1中记录的id打开一个特定的网格页面

I work with yii1.

I have a multi-page list of records, which is displayed using CGridView, sorted in a certain way.

I have id of the record. And I want to open the page on which this record with this exact id is displayed.

Roughly speaking, link /list?too=123 opens the 12th page of the grid, and among all records on this page there is an entry with id 123.

What's the easiest way to do this?

  • 写回答

2条回答 默认 最新

  • dpfad62426 2017-04-11 04:22
    关注

    My way of doing it-

    • Write code to get page number from the item id. In this case controller action will calculate which page needs to be loaded, using the existing/seperate search.
    • Pass this page number in the view file, where the grid is getting loaded.
    • If this special page number is passed, then just load that page when passing $model->search() to the CGridView.

    Hope it helps.

    评论

报告相同问题?

悬赏问题

  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用
  • ¥15 C++ yoloV5改写遇到的问题
  • ¥20 win11修改中文用户名路径
  • ¥15 win2012磁盘空间不足,c盘正常,d盘无法写入
  • ¥15 用土力学知识进行土坡稳定性分析与挡土墙设计