Hi,
I’m running a query with a CActiveDataProvider and producing a list that I push into a CActiveForm->dropDownList. The query returns data but its always limited to 10 results. I tried adding a CDbCriteria and set the limit to -1 thinking it would return all the results but it didn’t work. How can I run it in a way that all of the data ends up in the list.
Here is my code for the getSites function:
public function getSites()
{
/*$criteria = new CDbCriteria();
$criteria->order='siteName';
$criteria->limit= '-1';
*/
$dataProvider=new CActiveDataProvider('Permit');//,array('criteria'=>$criteria));
$data=$dataProvider->getData();
$return=array();
foreach($data as $s)
{
$return[$s->siteID] = $s->siteName;
}
return $return;
}
Here is my code for the form:
<div class="row">
<?php echo $form->labelEx($model,'siteID'); ?>
<?php echo $form->dropDownList($model,'siteID', $model->getSites()); ?>
<?php echo $form->error($model,'siteID'); ?>
</div>
Any help is appreciated,
Thanks,
-Nazum