Title: Combobox from PHP Post by: AJLX on January 03, 2018, 05:43:57 AM Hi All,
I'm trying to load data from a database into a combo box. MY current Code is this: Code: <input id="cc1" class="easyui-combobox" data-options=" My PHP file looks like this: Code:
This is a sample output of the JSON encode: Code: [{"fixture_id":"\"19\"","custom_name":"\"MAC Viper Profile\""},{"fixture_id":"\"20\"","custom_name":"\"MAC Viper Wash\""},{"fixture_id":"\"21\"","custom_name":"\"Molefay Two Light\""},{"fixture_id":"\"22\"","custom_name":"\"Mythos\""},{"fixture_id":"\"23\"","custom_name":"\"Robin 100 LEDBeam\""},{"fixture_id":"\"24\"","custom_name":"\"Robin Pointe\""},{"fixture_id":"\"25\"","custom_name":"\"Source 4 - 25\\\/50 Zoom \""},{"fixture_id":"\"26\"","custom_name":"\"Arena Zoomspot Narrow\""},{"fixture_id":"\"27\"","custom_name":"\"Arena Theatre Fresnel\""},{"fixture_id":"\"28\"","custom_name":false},{"fixture_id":"\"29\"","custom_name":"\"StudioCOB FC\""},{"fixture_id":"\"30\"","custom_name":"\"ARRI Junior 1000\""},{"fixture_id":"\"31\"","custom_name":"\"MAC Quantum \""},{"fixture_id":"\"32\"","custom_name":"\"CE Source 4 - 25\\\/50 Zoom \""},{"fixture_id":"\"33\"","custom_name":"\"Mac Aura XB\""},{"fixture_id":"\"34\"","custom_name":"\"Sunstrip\""},{"fixture_id":"\"35\"","custom_name":"\"Lanta Fireball Par64\""},{"fixture_id":"\"36\"","custom_name":"\"P-5\""},{"fixture_id":"\"37\"","custom_name":"\"4 Cell Mole\""},{"fixture_id":"\"38\"","custom_name":"\"Atomic 3000\""},{"fixture_id":"\"39\"","custom_name":"\"Spikie\""},{"fixture_id":"\"40\"","custom_name":"\"Source 4\""},{"fixture_id":"\"41\"","custom_name":"\"Sceptron \\\/ LED Bars\""},{"fixture_id":"\"42\"","custom_name":"\"XLED RGBW\""},{"fixture_id":"\"43\"","custom_name":"\"Intella Storm 1000\""},{"fixture_id":"\"44\"","custom_name":"\"Pageant CM-600Z\""},{"fixture_id":"\"45\"","custom_name":"\"XP-1000WZ\""},{"fixture_id":"\"46\"","custom_name":"\"XP-20R BSW\""},{"fixture_id":"\"47\"","custom_name":"\"GL-6\""},{"fixture_id":"\"48\"","custom_name":"\"Stormy CC\""},{"fixture_id":"\"49\"","custom_name":"\"Rama 1.2kW Fresnel\""},{"fixture_id":"\"50\"","custom_name":"\"Mirror Ball\""},{"fixture_id":"\"51\"","custom_name":"\"R1 Wash\""},{"fixture_id":"\"52\"","custom_name":"\"Source 4\""},{"fixture_id":"\"53\"","custom_name":"\"Fresnel 1.2kW \""}] This works, mostly, but all of the values that go into the combobox have "" around them. 1) How can I get rid of these? 2) Is there a way that I can do this with a text box instead of a combobox? Title: Re: Combobox from PHP Post by: jarry on January 03, 2018, 05:09:24 PM Please define the 'loadFilter' function to convert the original data to the desired format.
Code: <input id="cc1" class="easyui-combobox" data-options=" Title: Re: Combobox from PHP Post by: battlezad on January 04, 2018, 12:23:30 AM You are returning values with quotation marks around them.
{"fixture_id":"\"19\"","custom_name":"\"MAC Viper Profile\""} --> {"fixture_id":"19","custom_name":"MAC Viper Profile"} Are your values in database with quotation marks? Title: Re: Combobox from PHP Post by: AJLX on January 05, 2018, 12:22:04 PM Hi all,
I found out that the issue was due to how the data was encoded. I managed to bodge around it by using this working code: Code:
|