I’ve setup the most basic dataprovider/listview, but for some reason, sorting doesn’t work. The sortable attributes are displayed, but not clickable.
Here is the result.
$testdata = array();
for ($i = 0; $i < 200; $i++) {
$testdata[] = array(
"name" => "test",
"age" => rand(1, 80)
);
}
$dataProvider = new CArrayDataProvider($testdata,
array(
'id' => 'test',
'keyField' => 'name',
'pagination' => array(
'pageSize' => 10,
),
)
);
$this->widget('zii.widgets.CListView',
array(
'dataProvider' => $dataProvider,
'itemView' => 'dummy',
'enableSorting' => true,
'sortableAttributes' => array(
'name' => 'Name',
'age' => 'Age',
),
)
);
(the view ‘dummy’ is an empty file)
What am I doing wrong?