php - How can I create filters with radio buttons in yii -


i'm new yii framework. in admin page, gridview of data. have column named approved in gridview has either 0 or 1 value. want introduce 2 radio buttons 0 , 1 filters results 0 , 1 respectively , displays it. how can create filters radio buttons

you can make filter pretty anything:

'columns'=>array(     array(         'name' => 'approved',          'filter' => chtml::radiobutton(...) . chtml::radiobutton(...),     ), ), 

but if want keep things simple, feed array filter.

'columns'=>array(     array(         'name' => 'approved',         'filter' => ['0','1'],     ), ), 

it generate dropdown-list (sorry, no automatic radiobuttons) it's functional swear!

if want text options provide them this:

'filter' => ['1'=>'on', '0'=>'off'], 

also, yii automatically generate filter if set type boolean

'columns'=>array(     array(         'name' => 'approved',         'type' => 'boolean'     ), ) 

and there shortcut setting type:

'columns'=>array(     'approved:boolean', ) 

i know, many dropdowns , few radiobuttons. sorry.


Comments

Popular posts from this blog

javascript - DIV "hiding" when changing dropdown value -

Does Firefox offer AppleScript support to get URL of windows? -

android - How to install packaged app on Firefox for mobile? -