我可以在Yii中获得$ .fn.yiiListView.update的数量吗?

时间:2015-06-03 12:56:18

标签: php yii clistview

我想为我的结果运行双重分页,因为它有数百万的结果。当我使用$.fn.yiiListView.update更新结果时,我需要计算它返回的记录数。

1 个答案:

答案 0 :(得分:0)

CGridView和CListView中有特殊 $variables

CListView 小部件调用每个项目的部分呈现_view,在调用每个项目之前设置这些变量:

$data - the current object or hash being rendered
$index - the zero-based index of the item being rendered (0, 1, 2, ...)
$this - the owner of the widget, usually the calling controller
$widget - the CListView widget itself

CGridView 小部件以表格形式显示数据,并且每个'value'=> '...'字符串是eval'd,这些变量可用:

$data - the current object or hash being rendered
$row - the zero-based index of the item being rendered (0, 1, 2, ...)
$this - the CGridColumn object representing the column being rendered
$this->grid - the CGridView object that owns the column
$this->grid->owner - the owner of the grid, usually the calling controller

所以我猜 $ row $ index 是您需要的变量。 Source.