Answer the question
In order to leave comments, you need to log in
Why doesn't search work?
The filter stopped working, I can’t understand why and where the error is, I debugged it, and as it turned out, criteria does not receive any data. model
$criteria = new CDbCriteria;
$criteria->with = array('street' => array('with' => 'town'));
$criteria->compare('ID', $this->ID);
$criteria->compare('Town', $this->Street_ID, true);
$criteria->compare('Surname', $this->Surname, true);
$criteria->compare('Patronymic', $this->Patronymic, true);
$criteria->compare('Name', $this->Name, true);
$criteria->compare('Building', $this->Building);
$sort = new CSort;
$sort->attributes = array(
'street' => array(
'asc' => 'street,town',
'desc' => 'Street DESC, Town DESC',
),
'*'
);
return new CActiveDataProvider(get_class($this), array(
'criteria' => $criteria,
'sort' => $sort,
));
public function actionIndex()
{
$model = new Fio('search');
$model->unsetAttributes(); // clear any default values
if (isset($_GET['Fio']))
$model->attributes = $_GET['Fio'];
$dataProvider = new CActiveDataProvider('Fio');
$this->render('index', array(
'dataProvider' => $dataProvider,
'model' => new Fio,
'phone' => new Phone,
));
}
'id' => 'fio-grid',
'filter' => $model,
'dataProvider' => $model->search(),
'columns' => array(
'Surname',
'Name',
'Patronymic',
array(
'name' => 'street',
'value' => function ($data) {
$output = "";
if ($data->street instanceof Street) {
$output .= $data->street->Street;
if ($data->street->town instanceof Town) {
$output .= "," . $data->street->town->Town;
}
}
return $output;
},
),
'Building',
array(
'htmlOptions' => array('nowrap' => 'nowrap'),
'class' => 'booster.widgets.TbButtonColumn',
),
help me understand what is my mistake
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question