EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: dtucker on February 05, 2014, 06:31:45 AM



Title: Combobox default Text
Post by: dtucker on February 05, 2014, 06:31:45 AM
How can I set default text to notify the user on what to do? Example would be to set text such as "Select an Option" as the first option but obviously wouldn't fire an event.

Here's my current code:

Code:
$('#cboParentOrganization').combobox({
            url:'Organization/GetOrganizationByRole.php',
            valueField:'orgid',
            textField:'orgname',
            panelHeight:'190',
            width:'350',
            onSelect: function(rec)
            {
             
            }
        });

Thanks


Title: Re: Combobox default Text
Post by: stworthy on February 05, 2014, 07:00:48 AM
The data item with 'selected' set to true will be auto selected after loaded data successfully. Please refer to this example http://www.jeasyui.com/demo/main/index.php?plugin=ComboBox&theme=default&dir=ltr&pitem=Load%20Dynamic%20ComboBox%20Data.


Title: Re: Combobox default Text
Post by: dtucker on February 05, 2014, 07:06:23 AM
Thanks, but that doesn't seem to show how to put text in a combobox to insert text to instruct the user to "Select". That selected a value which I don't see how it instructed the combobox to select a value.

Thanks


Title: Re: Combobox default Text
Post by: stworthy on February 05, 2014, 08:03:48 AM
Do you wish to add text prompts to the textbox? If so, please try the code below:
Code:
$('#cboParentOrganization').combobox({...});
$('#cboParentOrganization').combobox('textbox').attr('placeholder','Select an Option');