การใส่ตัวกรองในYii2 ใสใสตัวController เลยง่ายๆ
$dataProvider = new \yii\data\ArrayDataProvider([
'allModels' => $rawData,
'pagination' => FALSE,
//'pagination' => ['pagesize' => 5],
]);
$dataProvider->sort->attributes['DATE_SERV'] = [
'asc' => ['DATE_SERV' => SORT_ASC],
'desc'=>['DATE_SERV' => SORT_DESC],
'label' => 'วันมารับบริการ'
];
$dataProvider->sort->attributes['HOSPNAME'] = [
'asc' => ['HOSPNAME' => SORT_ASC],
'desc' => ['HOSPNAME' => SORT_DESC],
'label' => 'สถานบริการ'
];
$dataProvider->sort->attributes['HOSPCODE'] = [
'asc' => ['HOSPCODE' => SORT_ASC],
'desc' => ['HOSPCODE' => SORT_DESC],
'label' => 'รหัส'
];
return $this->render('thaimed_cup', [
'searchModel' => $searchModel,
'dataProvider' => $dataProvider,
]);
}
ไม่มีความคิดเห็น:
แสดงความคิดเห็น