Title: Combobox select default - HOW Post by: tlombard on December 23, 2013, 07:38:58 AM I have a combobox:
Code: <input id="unit_FIELD" class="easyui-combobox" I'm populating the ComboBox just fine with the get_units.php code. Code: [{"unitID":"ALL"},{"unitID":"001"},{"unitID":"002"},{"unitID":"003"},{"unitID":"004"}] I need to be able to have a default selected...How do I select the first item in the combox by default WHEN the combobox is popluated from a Database? -Tom Title: Re: Combobox select default - HOW Post by: stworthy on December 24, 2013, 05:54:10 PM A data item with 'selected' set to true will be selected by combobox. So, add 'selected' property to what item you want to be selected.
Code: [{"unitID":"ALL","selected":true},{"unitID":"001"},{"unitID":"002"},{"unitID":"003"},{"unitID":"004"}] Title: Re: Combobox select default - HOW Post by: tlombard on December 25, 2013, 09:31:06 AM I have not been able to add the ,"selected":true into that array push item
Code: $items = array(); Title: Re: Combobox select default - HOW Post by: ryupanqui on December 26, 2013, 09:15:53 AM try this
Code: $items = array(); Title: Re: Combobox select default - HOW Post by: tlombard on December 26, 2013, 10:53:12 AM SOLVED...thanks 'ryupanqul'
Code: $rs = mysql_query("SELECT unitID FROM unit ORDER BY case when unitID = 'All' THEN 0 ELSE 1 END, unitID"); |