This is a migrated thread and some comments may be shown as answers.

Inline Add - Not getting dropdown default value

1 Answer 885 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Piyush
Top achievements
Rank 1
Piyush asked on 12 Jun 2014, 12:03 PM
Hello,

I am executing the inline add/edit. During inline add, I have a dropdown values which are pulled from database but when I click then not getting the default selected value in save operation, If change dropdown value and click on save then getting the dropdown value.

Thanks in advance.

1 Answer, 1 is accepted

Sort by
0
Vladimir Iliev
Telerik team
answered on 16 Jun 2014, 08:48 AM
Hi,

In current case you should either set the "optionLabel" option of the dropDownList or set default value for current field in the dataSource "schema.model.fields". Please check the example below:
  • set the "optionLabel" of the dropDownList:
    .kendoDropDownList({
      optionLabel: "- please select -"
      autoBind: false,
  • set "defaultValue" for the current field in the dataSource schema, equal to the first item in the list:
    dataSource: {
        schema: {
            model: {
                id: "ProductID",
                fields: {
                    ProductID: { editable: false, nullable: true },
                    //example of setting defaultValue for complex field
                    Category: {
                        defaultValue: {
                            CategoryID: 1,
                            CategoryName: "Beverages"
                        }
                    },
                    //example of setting defaultValue for primitive field
                    EmployeeID: { defaultValue: 1 },
Regards,
Vladimir Iliev
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
Piyush
Top achievements
Rank 1
Answers by
Vladimir Iliev
Telerik team
Share this question
or