optionLabel as a normal option

6 posts, 0 answers
  1. Pierre
    Pierre avatar
    10 posts
    Member since:
    May 2015

    Posted 21 Apr Link to this post

    Hi !

    I'd like to know if it's possible to display the optionLabel as the first option of the DropDownList. I need this functionality to be homogeenous with other select components.

    I also would like to know if it's possible to manage the "required" attribute if I create an option by myself without using the "optionLabel".

     

    Thanks for your help.

     

     

     
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 25 Apr Link to this post

    Hello,

    I am not sure I understand your question very well. Basically, the optionLabel gets displayed as a first option by default. Also, the "required" validation rule works as expected when the optionLabel is selected. Would you please check this example and let me know if I am missing something?

    Regards,
    Alexander Popov
    Telerik
     
    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. Rick
    Rick avatar
    21 posts
    Member since:
    Jul 2015

    Posted 27 May Link to this post

    Hello,

    I have a similar need. I want all the values in the datasource to be presented without an optionLabel. I set default values on the create window. optionLabel's translate to null which I do not want to allow.

    Rick

  5. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 30 May Link to this post

    Hello Rick,

    Can you share more details about your scenario and if possible - some code snippets? 

    Regards,
    Alexander Popov
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
  6. Rick
    Rick avatar
    21 posts
    Member since:
    Jul 2015

    Posted 31 May in reply to Alexander Popov Link to this post

    I see in my code below that I am specifying an optionLabel text value.

    I think that I want to have a default value and show its text.

    Null is not permitted as a value here, and in other similar situations.j

    Thanks,

    Rick

    $("#IssueType").kendoDropDownList({ dataSource: window.DataSource.IssueTypeDS,
        autoBind: true,
        dataTextField: "IssueTypeName",
        dataValueField: "IssueType",
        valuePrimitive: true,
        optionLabel: localize("format", "SelectType")
    });

  7. Alexander Popov
    Admin
    Alexander Popov avatar
    1416 posts

    Posted 02 Jun Link to this post

    Hello Rick,

    In case no option label is required, then I would recommend omitting the configuration option entirely: 
    $("#IssueType").kendoDropDownList({ dataSource: window.DataSource.IssueTypeDS,
        autoBind: true,
        dataTextField: "IssueTypeName",
        dataValueField: "IssueType",
        valuePrimitive: true
    });


    Regards,
    Alexander Popov
    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