walkboy / yii2-filterform
Yii2表单样式过滤器
0.1
2019-02-08 18:01 UTC
Requires
- php: >=5.6.0
This package is auto-updated.
Last update: 2024-09-19 10:23:28 UTC
README
将 "walkboy/yii2-filterform": "dev-master" 添加到 composer.json 中,并运行 composer update
使用方法
_filters.php
use walkboy\FilterForm\FilterForm;
<?php
$form = FilterForm::begin([
'method' => 'get',
'options' => [
'class' => 'filter-form',
'data-pjax' => 1,
]
]);
echo $form->field($searchModel, 'type')->dropDownList([
'1' => 'Foo',
'2' => 'Bar',
])->label('Type');
// insert fields here
FilterForm::end();
?>
index.php
<?php Pjax::begin(); ?>
<?= $this->render('_search', ['model' => $searchModel]); ?>
<?= GridView::widget() ?>
<?php Pjax::end(); ?>