Hi, everyone! I’ve got a problem with kartik, when I was using Jui DatePicker it was working, but when I switched to kartik, the gridview filter control disappeared, I’m not sure if it has something to do with the joinwith in search.
here is the index.php
[
'label' => 'Trxn Date',
'attribute' => 'stock',
'value' => 'stock.trxn_date',
'content' => function ($model, $key, $index, $column) {
return Yii::$app->formatter->asDate($model->stock->trxn_date);
},
'filterType'=> \kartik\grid\GridView::FILTER_DATE,
'filterWidgetOptions' => [
'options' => ['placeholder' => 'Select date'],
'pluginOptions' => [
'format' => 'M-dd-yyyy',
'todayHighlight' => true
]
],
'group' => true,
'format' => 'html'
],
And here is the SearchModel:
public $stock_trxn_date;
public function rules()
{
return [
[['stock_trxn_date_2'], 'safe'],
];
}
public function search($params)
{
$query = Stocktrxn::find()->joinWith('stock');
$dataProvider = new ActiveDataProvider([
'query' => $query,
]);
$this->load($params);
if (!$this->validate()) {
// uncomment the following line if you do not want to return any records when validation fails
// $query->where('0=1');
return $dataProvider;
}
$query->andFilterWhere(['stock.trxn_date' => $this->stock_trxn_date]);
return $dataProvider;
}