</p> <div id="statusMsg"> <?php if (Yii::app()->user->hasFlash('success')) { ?> <div class="alert alert-block alert-success"> <?php echo Yii::app()->user->getFlash('success'); ?> </div> <?php } ?> <?php if (Yii::app()->user->hasFlash('error')) { ?> <div class="alert alert-block alert-error"> <?php echo Yii::app()->user->getFlash('error'); ?> </div> <?php } ?> </div> <?php $this->widget('bootstrap.widgets.TbGridView', array('id' => 'company-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array('name', 'website', array('name' => 'comp_type_id', 'value' => '$data->compType->description', 'filter' => CompanyType::model()->getTypes(), 'htmlOptions' => array('width' => '100px')), array('class' => 'bootstrap.widgets.TbButtonColumn', 'afterDelete' => 'function(link,success,data){ if(success) $("#statusMsg").html(data); }'))));
public function getTypes() { return CHtml::listData(CompanyType::model()->findAll(), 'comp_type_id', 'description'); }
<?php $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('id' => 'company-form', 'enableAjaxValidation' => false)); ?> <p class="help-block">Fields with <span class="required">*</span> are required.</p> <?php echo $form->errorSummary($model); ?> <?php echo $form->dropDownListRow($model, 'comp_type_id', CompanyType::model()->getTypes()); ?> <?php echo $form->textFieldRow($model, 'name', array('class' => 'span5', 'maxlength' => 128)); ?> <?php echo $form->textFieldRow($model, 'website', array('class' => 'span5', 'maxlength' => 128)); ?> <?php echo $form->textFieldRow($model, 'telephone', array('class' => 'span5', 'maxlength' => 15)); ?> <?php echo $form->textAreaRow($model, 'description', array('rows' => 6, 'cols' => 50, 'class' => 'span8')); ?>