kartik editable + datetimepicker

Hi!

Hello! I try using editable with datetimepicker widget. I store the datetime as UnixTimestamp in the DB. The problem is that the date/time is not getting converted into the human understandable format. Here’s the code I use. Where is the mistake?





                [

                    'class' => 'kartik\grid\EditableColumn',

                    'attribute' => 'date_time_game',

                    'editableOptions' => [

                        'inputType' => \kartik\editable\Editable::INPUT_DATETIME,

                        'name' => 'date_time_game',

                        'options' => [

                            'convertFormat' => true,

                            'pluginOptions' => [

                                'autoclose' => true,

                                'todayHighlight' => true,

                                'minuteStep' => 15,

                                'format' => 'dd.mm.yy hh:ii',

                            ],

                            'type' => DateTimePicker::TYPE_COMPONENT_APPEND,

                            'size' => 'md',

                            'value' => function($model) {

                                return date('d.m.y H:i', $model->date_time_game);

                            },

                        ]

                    ],

                ],



The options[‘value’] will not be parsed but directly the data cell value derived from the grid cell for the model attribute value.

You can try using kartik\datecontrol\DateControl widget in your editable option to make this seamless - without you needing to write any conversion code.

However if you wish to use DateTimePicker… then you must change the grid cell value so that the editable widget can receive it correct.

Kartik, thank you very much. It works now .And, yes, I need DateTimePicker because the time also matters in my case.

I have one more question on this if I can… The grid is pretty large (~200 rows), and there are some performance issues. When the page is renewed, the browser stops responding for >10 sec.Not just page load takes a while but the whole browser hangs. I know I could use pagination or smth similar to reduce number of records to be displayed on one page, but I would like see them all. Are there any recommendations how I can improve it?