Search in GridView does not show results

Hello everyone, I just used a krajee datetime picker to easily get the time when I search it through gridView but why it doesn’t not show any results, I didn’t edit anything at the TicketSearch.php model. I’ve used TIMESTAMP in the time_start

The Widget Code in GridView


                'attribute' => 'time_start',

                'value' => 'time_start',

                'format' => 'raw',

                'filter' => DateTimePicker::widget([

                    'model' => $searchModel,

                    'attribute' => 'time_start',

                    'pluginOptions' => [

                        'autoclose' => true,




When I create something it automatically gets the computer time

public function actionCreate()


        $model = new Ticket();

        if ($model->load(Yii::$app->request->post()) && $model->save())


            return $this->redirect(['view', 'id' => $model->id]);

        } else {

        //  $employeeIDs = ArrayHelper::map(Employee::find()->all(), 'id', 'emp_name');

            $model->time_start = date('y-m-d h:i:s');

            $model->status = ('On Going');

        //  $model->employee_respond_id = array_rand($employeeIDs);

            return $this->renderAjax('create', [

                'model' => $model,




Cause you need set time_start in $searchModel

It is already there, I’ve already generated the Search Model.

Does your filter work as expected with the datetime picker restored to a default plain text input?

You say that “time_start” is TIMESTAMP. And in gii-generated “search” method, the filtering is implemented using exact comparison by default. I guess it’s very difficult to get a matching record.

I tried the default plain text and it works fine. I don’t why when I use the widget it doesn’t work.


I get it now, it doesn’t work using widget because I need to input the exact ‘time_start’ like in the plain text. For example if the ‘time_start’ is 2017-10-17 05:32:03 then I need to type the whole time_start which is 2017-10-17 05:32:03 but in the datetime widget I need to select the exact time_start which also includes the seconds

If I were an end user of your app, I would not want to use a filter that would require me to input (or select) the exact date time. Just a date without time would be enough, wouldn’t it?

Or, I would rather like to filter the records by a range of date: “date_from” and “date_to”. :)

Yeah thanks, I followed your advice which it only requires the year and month to be inputted. Also I edited a little code in the search model.

$query->andFilterWhere(['like', 'time_start', $this->time_start]);

Oh, that’s really nice! I didn’t think of it, but it’s the best.