KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

How to select default options in multiple selection drop down #2185

Open Komuraiah A opened this topic on on Jul 7, 2021 - 4 comments

Komuraiah A commented on Jul 7, 2021

Dear Team,I am implementing the code of multiple selection drop down.now I want to implement if we not select any option and click on submit then default select all option .so please help.

Komuraiah A commented on Jul 7, 2021

Dear Team,I am implementing the code of multiple selection drop down.now I want to implement if we not select any option and click on submit then default select all option .so please help.

Sebastian Morales commented on Jul 8, 2021

I think there're two ways:

1 . In function defaultParamValues(), get all data of multi selection and assign them to the input's default value:

protected function defaultParamValues()
    {
        // get data for $allMultiSelectData 
        return array(
            "multiSelect"=>$allMultiSelectData, 

2 . In function setup(), get get all data of multi selection via datastore piping and assign it to the report's params:

protected function setup()
    {
        $this->src("mydatasource")->query($query)
        ->pipe($this->dataStore("multiSelect"))
        ->requestDataSending();
        $rows = $this->dataStore("multiSelect")->data());
        $allMultiSelectData = [];
        foreach ($rows as $row) {
            $allMultiSelectData[] = $row["multiSelectColumn"];
        }
        $this->params["multiSelect"] = $allMultiSelectData;

Hope these work for you. Rgds,

Komuraiah A commented on Jul 8, 2021

Dear Team, Thanks for supporting, I am implementing as per your instructions but its shows empty page.

Sebastian Morales commented on Jul 8, 2021

Print out your $allMultiSelectData variable to see its value as well as data of the datastore for your multi select. Rgds,

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

Inputs