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

DropdownList value not popolating back to grid from popup editing

3 Answers 449 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Tinju
Top achievements
Rank 1
Tinju asked on 27 Feb 2013, 09:41 AM
Following is the code i used, Once i select dropdownlist value in popup editing then [Object][Object] in the column of the grid

<script>
    var datavalue = [];
    datavalue.push({TypeValue: "---" });
    datavalue.push({ TypeValue: "New" });
    datavalue.push({ TypeValue: "Important" });
    datavalue.push({ TypeValue: "Remark" });
    datavalue.push({ TypeValue: "Complaint" });
          
    var dropDownDataSource = new kendo.data.DataSource({
        data: datavalue,
        schema: {
            model: {
                fields: {
                    TypeValue: { type: "string" }
                        }
                    }
                }
    });    
  </script>
  <script id="popup_editor" type="text/x-kendo-template">
<p>Custom editor template</p>

<div class="k-edit-label">
<label for="Date">Date</label>
</div>
<!-- datepicker editor for field: "Date" -->
<input type="text" 
name="Date" 
data-type="date" 
data-bind="value:BirthDate" 
data-role="datepicker" />

<div class="k-edit-label">
<label for="Type">Type</label>
</div>
<!-- drop down list editor for field: "Type" -->
<input name="TypeValue" 
data-bind="value:TypeValue" 
data-value-field="TypeValue" 
data-text-field="TypeValue" 
data-source="dropDownDataSource" 
data-role="dropdownlist" />

<div class="k-edit-label">
<label for="NoteBy" style="color: red;">NoteBy</label>
</div>
<!-- textbox editor for field: "NoteBy" -->
                  <input type="text" class="k-input k-textbox" name="NoteBy" data-bind="value:NoteBy"/>
                  
<div class="k-edit-label">
<label for="Description">Description</label>
</div>
                  <input type="text" class="k-input k-textbox" name="Description" data-bind="value:Description"/>

</script>


                <div id="NoteGrid" style="height: 380px"></div>


            <script>
    $(document).ready(function() {
      
   $("#NoteGrid").kendoGrid({ // create Grid from div HTML element Kendo
            dataSource: {
                data: [],
                    schema: {
                        model: {
                            fields: {
                                Date: { type: "date" },
                                Type: { type: "string"},
                                NoteBy: { type: "string" },
                                Description: { type: "string" }
                                    }
                                }
                            }
                        },
            selectable: "row",
            scrollable: true,
            navigatable: true,
            sortable: true,
            resizable: true,
            groupable: false,
            filterable: true,
            columnMenu: true,
            columns: [
            {
                field: "Date",
                title: "Date",
                width: 80
            },
            {
                field: "TypeValue",
                title: "Type",
                width: 60
            },
            {
                field: "NoteBy",
                title: "Note By",
                width: 80
            },
            {
                field: "Description",
                title: "Description",
                width: 100
            },
            {
                command: [
                { name: "edit",
                    text: { update: "Save" }
                }],
                hidden: true
            }
            ],
            toolbar: ["create"],
            edit: function (e) {
//                $("#editor").kendoEditor();
                e.container.data("kendoWindow").title("Add Note");
                e.container.find('.k-grid-update').css('float', 'right');
                e.container.find('.k-grid-cancel').css('display', 'none');
            },
            editable: {
                mode: "popup",
                template: kendo.template($("#popup_editor").html())
            },
            save: function (e) {
                var grid = $("#NoteGrid").data("kendoGrid");
                grid.refresh();  
            },
            detailInit: function (e) {
                var grid = $("#NoteGrid").data("kendoGrid");
                grid.element.find('tbody tr:first').addClass('k-state-selected')
            }
        });
    });

            </script>

3 Answers, 1 is accepted

Sort by
0
Tinju
Top achievements
Rank 1
answered on 28 Feb 2013, 06:42 AM
Can someone replay to this
0
Nikolay Rusev
Telerik team
answered on 01 Mar 2013, 08:35 AM
Hello Tinju,

The answer is posted in the following forum thread:
http://www.kendoui.com/forums/ui/grid/popup-editing-with-dropdownlist-not-working-properly.aspx

Regards,
Nikolay Rusev
the Telerik team
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
0
Tony Sprague
Top achievements
Rank 1
answered on 03 Mar 2013, 11:34 AM
This fix did not work for me initially. I have a remote data source and it was only when I populated the dropdown target field with a blank '' (rather than a null) that things started to work. 
Tags
General Discussions
Asked by
Tinju
Top achievements
Rank 1
Answers by
Tinju
Top achievements
Rank 1
Nikolay Rusev
Telerik team
Tony Sprague
Top achievements
Rank 1
Share this question
or