How to Add "-- Please Select --"

7 posts, 0 answers
  1. briankb
    briankb avatar
    88 posts
    Member since:
    Feb 2004

    Posted 30 Dec 2011 Link to this post

    How do I add another item at index 0 of "-- Please Select --"? 

    <input id="coursecats" style="width:400px;"/>

    $("#coursecats").kendoDropDownList({
                    index: 0,
                    dataTextField: "Title",
                    dataValueField: "CourseID",
                    filter: "contains",
                    dataSource: courses
                });

    Note: The courses variable is already set on the page and works fine with the Grid and AutoComplete already on the page.

    Seems like there is a lot of detail missing from the docs. Are there beta docs somewhere we can access and see more details on the widgets?
  2. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 03 Jan 2012 Link to this post

    Hello Brian,

     
    The DropDownList will support option label in the next official release of KendoUI scheduled for the end of January 2012. For now you can add item on the client. Check this jsFiddle demo for more information.

    We are working to improve our documentation and will update it as soon as possible.

    Greetings,
    Georgi Krustev
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Kendo UI is VS 2017 Ready
  4. Justin
    Justin avatar
    14 posts
    Member since:
    Dec 2011

    Posted 03 Jan 2012 Link to this post

    I just solved a similar problem where I wanted to perminantly have "Add Field" displayed by the drop down. Maybe my solution might help you to find yours.

    http://www.kendoui.com/forums/ui/dropdownlist/drop-down-display-text.aspx

    If you simply want to change whats displayed and not add an actual element to the list you can do something like:
    var data = $("#coursecats").kendoDropDownList({
                    index: 0,
                    dataTextField: "Title",
                    dataValueField: "CourseID",
                    filter: "contains",
                    dataSource: courses
                });
    data.text("-- Please Select --");
  5. Amol
    Amol avatar
    1 posts
    Member since:
    Nov 2008

    Posted 10 Mar 2012 Link to this post


    I am using Kendo UI 2012.1.229.beta

    optionLabel:"Please Select..."  Works for me....

    see below:

    var data = $(
    "#coursecats").kendoDropDownList({
    index: 0,
    dataTextField: "Title",
    dataValueField: "CourseID",
    filter: "contains",
    dataSource: courses,
    optionLabel: "Please Select...",
    });



  6. chris_cf
    chris_cf avatar
    53 posts
    Member since:
    Jul 2007

    Posted 30 Mar 2012 Link to this post

    Is there a way to use a different style on the optionLabel text? Perhaps to make it a lighter color than the real options.
  7. Sharon
    Sharon avatar
    9 posts
    Member since:
    Dec 2013

    Posted 23 Jul 2014 in reply to Amol Link to this post

    Is there any way to implement it at kendo combo-box too?
  8. Georgi Krustev
    Admin
    Georgi Krustev avatar
    3707 posts

    Posted 23 Jul 2014 Link to this post

    Hello Sharon,

    Kendo UI ComboBox supports placeholder functionality. If you would like to use an option label, then I will suggest you use the DropDownList widget with filtering (available since Q2 2014). 

    Regards,
    Georgi Krustev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top
Kendo UI is VS 2017 Ready