KoolReport's Forum

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

Select defaultOption changes the value of databinds #121

Open Rohit opened this topic on on Sep 27, 2017 - 28 comments

Rohit commented on Sep 27, 2017

When I use Select input control without default option it sends me correct results in databinded values but if i use defaultOption then it changes the values of databinded fields.

 //  "defaultOption"=>array(""=>"--"),
                              "dataBind"=>array(
                                        "text"=>"login",
                                        "value"=>"id",
                               ),

 "dataBind"=>array(
                                        "text"=>"login",
                                        "value"=>"id",
                               ),

How to solve this....help

KoolReport commented on Sep 27, 2017

Hi, could you please explain clearer. I have not understood the term "change in binding" The way defaultOptions works is that it added itself the default options to the data you have and stay on top of the selected options.

Rohit commented on Sep 27, 2017

In first image where i have not used defaultoption see the value for "root@localhost" send after submitting the form is "1" as it can be seen in JSON encode print But after i use defaultoption see the value of "root@localhost" in JSON encode print below as "2" So it is changing the results of my selection.....

AND my defaultoption "--" is also not coming on the top of other texts.

KoolReport commented on Sep 27, 2017

I will test the Select in your case and if there is bug, the updated version of Inputs will be released tomorrow.

Rohit commented on Sep 27, 2017

ok thank you for support

Waiting for your reply

Rohit commented on Sep 28, 2017

Hello KoollPHP, Any updates on my issue?

KoolReport commented on Sep 28, 2017

We are working on that. BTW, is it possible that you can send us the dataStore that you use for Select. You may insert it into table to see all the options. I would like to see your data if anything that making it go wrong.

Rohit commented on Sep 28, 2017

these are some screenshots of my database and datastore

KoolReport commented on Sep 29, 2017

Hi,

We have release Inputs package 2.7.0. You may download now. Please let me know if the issue still persists.

Actually we could not be able to reproduce the issue. Anyway hope that the new version work. There is change in input for defaultOption which text of option will go first, for example:

"defaultOption"=>array("visible text"=>"hidden value"),
KoolReport commented on Oct 3, 2017

I have not heard from you since then. I wonder if the problem is solved?

Rohit commented on Oct 18, 2017

Hey, I tried input_2.7.0 package but it is causing same problems as before

this is how i used defaultoption and below is the result

First of all you can see that it is working in reverse according to your documentation this is the format

array("{text}"=>"{value}")

But in actual "text" is coming as value and "value" is coming as text in defaultOption But that is not my primary problem, problem is it is still changing the value of my dropdown option and causing issues by fetching wrong data

See i have selected "Super cool" in dropdown but it is getting me the data of "Admin Felicity" because as you can see it is sending value as "1" for "SuperCool" but value "1" is assigned to "Admin Felicity".

Thank you for your support

KoolReport commented on Oct 19, 2017

Hi Rohit,

I've tested Select2 with similar to your data case and it seems working well. Even the defaultOption is working as well with correct format "text"=>"value". I am really curious about the case. Is it possible that you can setup a small example online with the issue. I would like to see.

By the way I see in the "dataBind" you set "text"=>"concat_ws(' ',first_name,last_name)". Is it the name of column?

Rohit commented on Oct 23, 2017

i have sent you the link via email please check

Rohit commented on Oct 25, 2017

Hey koolreport any updates i have also sent you the links for my code by email

KoolReport commented on Oct 25, 2017

I received your code, be right back!

KoolReport commented on Oct 28, 2017

Hi Rohit,

After going into the mystery. I found the issue. Problem is that you have another "inputs" folder inside "koolreport". The location is "koolreport/inputs". May be you have mistakenly copied the inputs package to koolreport folder instead of koolreport/packages. The version there is 2.5.0 which contains bug.

So the solution is

Just delete that folder

KoolReport commented on Oct 30, 2017

Does everything work well now?

Rohit commented on Oct 31, 2017

yes it is working perfectly fine

Rohit commented on Nov 2, 2017

Can we add defaultOption in Select2 input control with multi selection kept true because when i use defaultoption code in Select2 it is putting it as a one of value which can be selected in multiple options

DefaultOption in Select2 would be great

Thank you for your support

Rohit commented on Nov 3, 2017

Hey Koolreport team any updates on last comment

KoolReport commented on Nov 3, 2017

Well, what you can do is to input the default values in format of array in the defaultParamValues() function

Rohit commented on Nov 3, 2017

That shows me the data of that value without selecting it. I want something like defaultoption in Select2 eg. (----Select User----)

KoolReport commented on Nov 3, 2017

How is about using the "placeholder"?

Rohit commented on Nov 3, 2017

yeah exactly, that would be great

KoolReport commented on Nov 3, 2017

So please try to set "placeholder"=>"Select"

Rohit commented on Nov 3, 2017

I tried it but placeholder is not getting displayed on the page but if I inspect select tag placeholder attribute is present

KoolReport commented on Nov 3, 2017

Understand the issue. Please do the following:

Select2::create(array(
    "options"=>array(
        "placeholder"=>"Select",
    )
));
Rohit commented on Nov 3, 2017

That's exactly what i wanted Thank you Koolreport for such support

KoolReport commented on Nov 3, 2017

You are welcome :)

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