BSelect

BSelect is new widget in Inputs control. The letter B stands for "Bootstrap". You may find the original BSelect control here.

To use BSelect, you do:

<?php
BSelect::create(array(
    'name'=>"my_select",
    "placeholder"=>"Select customer",
    "dataStore"=>$this->dataStore("customers"),
    "dataBind"=>array(
        "text"=>"customerName",
        "value"=>"customerId",
    ),
));
?>

Manual data input #

The same with other controls, BSelect support manual data input

<?php
BSelect::create(array(
    'name'=>"my_select",
    "placeholder"=>"Select customer",
    "data"=>array(
        "John Doe"=>"1",
        "Jane Doe"=>"2",
        "Whatever Doe"=>"3",
    )    

));
?>

Multiselect in BSelect #

To enable multi select feature in BSelect, you do:

<?php
BSelect::create(array(
    'name'=>"my_select",
    "multiple"=>true,
    "placeholder"=>"Select customer",
    "dataStore"=>$this->dataStore("customers"),
    "dataBind"=>array(
        "text"=>"customerName",
        "value"=>"customerId",
    ),
));
?>

Other options for BSelect #

BSelect support all original settings, you may use the "options" to set other settings for BSelect

<?php
BSelect::create(array(
    ...
    "options"=>array(
        "dropUp"=>true,
        ...
    ), 
));
?>

Here are full list of options for BSelect that you can set.

Client events #

BSelect supports below events:

namedescription
onDropdownShowA callback called when the dropdown is shown.
onDropdownHideA callback called when the dropdown is closed.s
onDropdownShownA callback called after the dropdown has been shown.
onDropdownHiddenA callback called after the dropdown has been closed.
<?php
BSelect::create(array(
    ...
    "clientEvents"=>array(
        "onDropdownShow"=>"function(){
            //Do something
        }",
    ), 
));
?>