CheckBoxList

Get started #

CheckBoxList shows list of checkbox for user to select.

<?php
\koolreport\inputs\CheckBoxList::create({
    "name"=>"customer",
    "dataStore"=>$this->dataStore("customer"),
    "dataBind"=>"customerName"
});
?>

In above example, we bind the CheckBoxList to the "customerName" column in the "customer" dataStore. As a result, CheckBoxList will show list of checkbox with customer name.

Values #

Values received from CheckBoxList is an array() containing the list of selected values.

Set different text and value #

<?php
\koolreport\inputs\CheckBoxList::create({
    "name"=>"customer",
    "dataStore"=>$this->dataStore("customer"),
    "dataBind"=>array("text"=>"customerName","value"=>"customerId")
});
?>

Make CheckBoxList display horizontally #

By default, the CheckBoxList display checkbox vertically but you can make it horizontally.

<?php
\koolreport\inputs\CheckBoxList::create({
    "name"=>"customer",
    "dataStore"=>$this->dataStore("customer"),
    "dataBind"=>"customerName",
    "display"=>"horizontal"
});
?>

Not use data binding #

If we do not need data binding, we can manually enter data.

<?php
\koolreport\inputs\CheckBoxList::create({
    "name"=>"customer",
    "data"=>array(
        "John Doe"=>"1",
        "Jane Doe"=>"2",
        "Whatever Doe"=>"3",
    )    
});
?>

Default option #

Sometime you need a default option, you do:

<?php
\koolreport\inputs\CheckBoxList::create({
    "name"=>"customer",
    "dataStore"=>$this->dataStore("customers")
    "dataBind"=>"customerName",
    "defaultOption"=>array("None"=>"none"),
});
?>

Client events #

CheckBoxList support change events happen when user changes his selection. The parameters in callback function will contain value which is the array of user's selections.

<?php
\koolreport\inputs\RadioList::create({
    ...
    "clientEvents"=>array(
        "change"=>"function(params){
            for(i in params.value)
            {
                console.log(params.value[i]);
            }
        }",
    )
});
?>

Get started with KoolReport

KoolReport will help you to construct good php data report by gathering your data from multiple sources, transforming them into valuable insights, and finally visualizing them in stunning charts and graphs.