【问题标题】:Can i get count of $.fn.yiiListView.update in Yii?我可以在 Yii 中计算 $.fn.yiiListView.update 吗?
【发布时间】:2015-06-03 12:56:17
【问题描述】:

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

【问题讨论】:

    标签: php yii clistview


    【解决方案1】:

    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.

    【讨论】:

      猜你喜欢
      • 2011-03-21
      • 2020-01-14
      • 1970-01-01
      • 1970-01-01
      • 2012-10-12
      • 2016-03-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多