So I am very new to both PHP and Yii but I have been able to generate a useful webapp using CGridView that is fully functional with the exception of the filter bars. When anything is typed the return is the grid of unfiltered results. I have a database with a table filled with transaction information and a table with companies that have completed those transactions.
My Model looks like this:
public function search()
{
// Warning: Please modify the following code to remove attributes that
// should not be searched.
$criteria=new CDbCriteria;
$criteria->compare('trx_id',$this->trx_id);
$criteria->compare('entity_company_all_company_id',$this->entity_company_all_company_id);
$criteria->compare('trx_industry',$this->trx_industry,true);
$criteria->compare('trx_stage',$this->trx_stage,true);
$criteria->compare('trx_amount',$this->trx_amount,true);
$criteria->compare('trx_date',$this->trx_date,true);
$criteria->compare('trx_product_stage',$this->trx_product_stage,true);
$criteria->compare('trx_product_description',$this->trx_product_description,true);
return new CActiveDataProvider($this, array(
'criteria'=>$criteria,
My view looks like this:
$this->widget('zii.widgets.grid.CGridView', array(
'id'=>'trx-grid',
'dataProvider'=>$dataprovider,
'filter'=>$model,
'pager'=>array(
'header'=>'',
'firstPageLabel'=>'<<',
'prevPageLabel'=>'<',
'nextPageLabel'=>'>',
'lastPageLabel'=>'>>',
),
//$trxRoundName = $model->trxRound->trx_round_name;
//$trxEntity = $model->trxEntity->entity_name;
//$trxIndSegDesc = $model->trxIndSegment->trx_ind_seg_description;
//$trxType = $model->trxType->trx_type_name;
'columns'=>array(
array( 'name' => 'entity_company_all_company_id',
'value'=>'$data->entityCompanyAllCompany->company_name',
'header'=> 'Company'),
array( 'name' => 'investor_name', 'header'=> 'Investor'),
array( 'name' => 'trx_industry', 'header' => 'Industry'),
array( 'name' => 'trx_stage', 'header' => 'Series'),
array( 'name' => 'trx_amount', 'header' => 'Total Raise (000s)'),
array( 'name' => 'trx_date', 'header' => 'Date'),
array( 'name' => 'trx_product_stage', 'header' => 'Product Status'),
array( 'name' => 'trx_product_description', 'header' => 'Product Description'),
)
));
Any tips would be greatly appreciated.