Answer the question
In order to leave comments, you need to log in
How can data be changed in GridView columns using DatePicker?
Hello, it is necessary that you can set a date in a table in a calendar format for different rows. I wrote my own code, but it only changes the first row in the column, and after refreshing the page, it resets it. Here is the code:
Model
['date_subscription', 'default', 'value' => null],
['date_subscription', 'date_subscription', 'timestampAttribute' => 'date_subscription'],
public $date;
public function rules()
{
return [
[['date_subscription'], 'safe'],
['date_subscription', 'default', 'value' => null],
...
if ($this->date !== null) {
$date = strtotime($this->date);
$query->andFilterWhere(['between', 'date_subscription', $date, $date + 3600 * 24]);
}
[
'label' => 'Дата подписки',
'attribute' => 'date_subscription',
'value' => function ($model, $key, $value) {
return \yii\jui\DatePicker::widget([
'attribute' => 'date_subscription',
'model' => $model,
]);
},
'format' => 'raw',
],
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