Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
960
igCombo intial value should be blank/empty/placeholder
posted

I'm having a bit of trouble with an igCombo element. I want the field to either be BLANK on entry to the page, or contain a "--Pick One--" (preferably semi greyed out, like the 'placeholder' in a text field.) nullText should work but doesn't; the page is loaded and the first list item is displayed.

The only way I can get it blank on initial display is to have TWO lines of code for it:

$("#ddlType").igCombo({ text:"" });

$("#ddlType").igCombo("option","text","");

Why do I need to have both of these to simply have nothing selected on a new page?

Parents
No Data
Reply
  • 10685
    Suggested Answer
    Offline posted

    Hello CJ,
    Default igCombo behavior is exactly what you require. You could see an online basic sample illustrating this at:
    http://igniteui.com/combo/overview
    In order to have a text displayed when there is no selection made, I suggests using nullText option, like described here:
    http://help.infragistics.com/jQuery/2014.2/ui.igcombo#options:nullText

    For example:
    $(function () {

                var data = [
                          { "ID":1, "Name": "John Smith", "Age": 45 },
                          { "ID":2, "Name": "Mary Johnson", "Age": 32 },
                          { "ID":3, "Name": "Bob Ferguson", "Age": 27 }
                    ];
               
                $("#combo").igCombo({
                    dataSource: data, //JSON Array defined above        
                    valueKey: "ID",
                    textKey: "Name",
                    nullText : "--Pick One--"
                });
            });

Children
No Data