Hi All.
I was hoping to embed a searchable form for Subscribers inside a Campaign view, but I cant sort or search this new form. (I was hoping to have 4 seperate searchable forms in tabs…)
Hope someone can help explain the correct way to approach this. I’ve only been learning Yii for a few weeks and seem to keep hitting these snags, but usually Google show the way !
Campaign View:
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'subscribers-grid',
'dataProvider'=>$model->getDPSubscribers(),
'filter'=>CustomerSubscription::model(),
'pager'=>array(
'header'=>'',
'firstPageLabel'=>'<<',
'prevPageLabel'=>'<',
'nextPageLabel'=>'>',
'lastPageLabel'=>'>>',
),
'columns'=>array(
array(
'name'=>'fk_customer_id',
'type'=>'raw',
'value'=>'CHtml::link($data->fkCustomer->name, array("customer/view", "id"=>$data->fk_customer_id))',
),
array(
'name'=>'fk_subscription_keyword',
'type'=>'raw',
'value'=>'$data->fkSubscriptionKeyword->keyword',
),
array(
'name'=>'subscription_date',
'type'=>'raw',
'value'=>'$data->subscription_date',
),
array(
'name'=>'content_key',
'type'=>'raw',
'value'=>'$data->content_key',
),
),
));
CustomerSubscription Model
//Data provider for subscribers
public function getDPSubscribers()
{
return new CActiveDataProvider('CustomerSubscription', array(
'criteria'=>array(
'condition'=>'fk_campaign_id=' . $this->id,
'order'=>'fk_customer_id ASC',
),
'pagination'=>array(
'pageSize'=>10,
),
));
}