This first example code works to make an activeCheckBoxList of each row for one table field. It list all itemNames and icludes a checkbox for each.
<div id="name">
<?php echo CHtml::activeCheckBoxList($model, 'itemId',
CHtml::listData(
ServiceItem::model()->findAll(), 'itemId',
'itemName'), array('template'=>'{input} {label}'));
?>
</div>
I need each row to include data from all of the fields.
CException:
ServiceItem and its behaviors do not have a method or closure named "queryAll".
<div id="all">
<?php echo CHtml::activeCheckBoxList($model, 'itemId',
CHtml::listData(
ServiceItem::model()->queryAll('true','Itemid=>1'),
'itemId','itemDescription'));
?></div>
So, in the model I added…
/* Get data from servieItem table for activeCheckBoxList */
public function populatelist()
{
$allitems = Yii::app()->db->createCommand()
->select('itemId, itemName, itemDescription, timeEstimate')
->from('serviceItem')
->where(':itemId=itemId', array(':itemId'=>1))
->queryAll();
return $allitems;
}
In the view…
<?php echo CHtml::activeCheckBoxList($model, 'itemId',
CHtml::listData(
ServiceItem::model()->populatelist(),
'itemId','itemName'));
?>
There isn’t an error,(yea) but only the itemName is listed with a checkbox.
??