RadioList

Get started #

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

In above example, we bind RadioList to the column customerName in dataStore customers. As a result, we will have a list of radio buttons with customer name to select from.

Different text and value #

Above example, both value and text of radio will be "customerName". However we can have different value and text. For example, select customerName and get the customerId as value.

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

Make the radios horizontal align #

By default, the RadioList will organize radios in vertical, but you can make it horizontal:

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

Not binding data #

If you do not want to bind data with dataStore, you can manually enter options:

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

Client events #

RadioList support change events happen when user changes the selection.

<?php
\koolreport\inputs\RadioList::create({
    ...
    "clientEvents"=>array(
        "change"=>"function(s){
            console.log(s.text);
            console.log(s.value);
        }",
    )
});
?>

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.