KoolReport's Forum

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

Unique options to select2 boxes in datatable #675

Closed iRiyada opened this topic on on Feb 14, 2019 - 2 comments

iRiyada commented on Feb 14, 2019

how to data bind unique values from datatable columns as options to select2 boxes? Now all the values are bound.So same options are repeated.

 select2::create(array(
                "multiple"=>true,
                "name"=>"تنتهيخلاليوم",
                "placeholder"=>"select ",
                 "dataStore"=>$new,
                 "dataBind"=>array(
                                 "text"=>"end_in_wd",                            
//all value from data table column "end_in_wd" as option -need only unique values
                                  "value"=>"end_in_wd",
                                  ),
           
                "attributes"=>array(
                    "class"=>"form-control"
                )
            ));
KoolReport commented on Feb 14, 2019

You need to use GROUP BY in your sql query so that the output are unqiue. Alternatively you can use SELECT DISTINCT

iRiyada commented on Feb 16, 2019

Thank you, it worked with 'distinct' sql .

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
solved

None