php - Filter Placeholders with Yii2 -


does know how implement placeholder or tooltip on gridview filter of yii2 framework? need stands out user let them know textbox in fact search filter.

look forward hearing responses.

preview

placeholder realized this:

<?= gridview::widget([     'dataprovider' => $dataprovider,     'filtermodel'  => $searchmodel,     'columns'      => [         [             'attribute' => 'name',             'filterinputoptions' => [                 'class'       => 'form-control',                 'placeholder' => 'type in characters...'              ]         ],         ['class' => 'yii\grid\actioncolumn' ],     ], ]); ?> 

class should provided, though not must - default styling class.

setting globally

the way found in config/web.php used application configuration:

$config = [     ...     'on beforerequest'          => function ($event) {         yii::$container->set('yii\grid\datacolumn', [             'filterinputoptions' => [                 'class'       => 'form-control',                 'placeholder' => 'type in characters...'             ]         ]);     },     ... ]; 

this event handler. on each request datacolumn configured use placeholder. detail information can found here. don't need adjust gridview configuration in order have placeholder. in handler can change other configurations well, of course.


Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

android - CollapsingToolbarLayout: position the ExpandedText programmatically -

Listeners to visualise results of load test in JMeter -