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

kendoDropDownList on the Grid displaying null after Save

1 Answer 426 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Raj
Top achievements
Rank 1
Raj asked on 28 Aug 2017, 07:37 PM

After I select an item from Dropdownlist and hit save, Grid is not displaying the description corresponding to the Id value returned from the service.

Here is the code snippet...

$("#grid").kendoGrid({
            dataSource: dataSource,
            pageable: false,
            columns: [
                {
                    field: "TransferTypeId",
                    title: "Transfer Type",
                    template: "#:TransferType#",
                    width: 150,
                    editor: function (container, options) {
                        $('<input data-bind="value:' + options.field + '" required/>')
                             .appendTo(container)
                             .kendoDropDownList({
                                 autoBind: true,
                                 dataTextField: "Value",
                                 dataValueField: "Key",
                                 valuePrimitive: true,
                                 dataSource: {
                                     transport: {
                                         read: {
                                             url: THIS_APP_PATH + "Api/Lookup/TransferType"
                                         }
                                     }
                                 }
                             });
                    }
                }] });

         What am I missing here?

         Appreciated for your help.

 

1 Answer, 1 is accepted

Sort by
0
Stefan
Telerik team
answered on 30 Aug 2017, 08:06 AM
Hello Raj,

Based on the provided information I can assume that the issue occurs because the TransferTypeId.Value has to be set inside the template.

In general, when a DropDown is used its value is originally a complex object and the template should reference the property of that object that has to be displayed.

This can be observed in our demo example:

http://demos.telerik.com/kendo-ui/grid/editing-custom

{ field: "Category", title: "Category", width: "180px", editor: categoryDropDownEditor, template: "#=Category.CategoryName#" },

I hope this is helpful.

Regards,
Stefan
Progress Telerik
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
Grid
Asked by
Raj
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or