Can i get count of $.fn.yiiListView.update in Yii?

135 Views Asked by At

I want run a dual pagination for my result as it has millions of results. When I am updating the result using $.fn.yiiListView.update, I need count of record returned by it.

1

There are 1 best solutions below

0
On

There are special $variables in CGridView and CListView.

The CListView widget calls your partial rendering _view on each item, setting these variables before calling each one:

$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

The CGridView widget displays data in tabular form, and when each 'value' => '...' string is eval'd, these variables are available:

$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

So I guess $row and $index are the variables you need. Source.