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

Urgent: Combobox in a kendo grid not working while appending additional rows

2 Answers 53 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Naga
Top achievements
Rank 1
Naga asked on 01 Oct 2016, 04:34 PM

I need exactly similar grid to this : http://demos.telerik.com/kendo-ui/grid/editing-custom

I am working on a grid with combobox for edit. i have a functionality to add row on button click. On button click i get data from database and add to grid like below.  Edit combo box template does not work from the second row. When user adds the first row, combo box works, but from the second row edit templates does not work. 

function AddNewROwToGrid()
{
 var grid = $("#MyGrid").data("kendoGrid");
    var datasource = grid.dataSource;
    $.ajax({
        type: 'GET',
        contentType: 'application/json',

        url: MYURL,
        success: function (resultData) {
            if (resultData.length > 0) {
                var gridExistingData = datasource.data();

               var mergedData = $.merge(gridExistingData, resultData);

                datasource.data(resultData);
            }
        }
    });
}

Below is the configuration of Grid.

 

editable: true,

{

            field: "MyField", title: "New Field", width: "180px",  template: "#=MyField#",
            editor: function(container, options) {
                $('<input data-text-field="MyField" data-value-field="MyField" data-bind="value:' + options.field + '"/>').appendTo(container).kendoComboBox({
            dataSource: {
                data: autoFillData
            },
            dataValueField: "MyField",
            dataTextField: "MyField",
            autobind: true
            });
            }
},        

Please help. it is urgent

2 Answers, 1 is accepted

Sort by
0
Dimiter Topalov
Telerik team
answered on 04 Oct 2016, 01:50 PM
Hello Naga,

Please try using the dataSource.add() method for adding the new items to the dataSource:

http://dojo.telerik.com/IJIHu

If the problem persists, we will need a similar isolated runnable project, where the issue is reproduced, so we can inspect it further. Thank you in advance.

Regards,
Dimiter Topalov
Telerik by Progress
Get started with Kendo UI in days. Online training courses help you quickly implement components into your apps.
0
Naga
Top achievements
Rank 1
answered on 10 Oct 2016, 02:08 PM

It worked great. 

Thanks !!!

Tags
Grid
Asked by
Naga
Top achievements
Rank 1
Answers by
Dimiter Topalov
Telerik team
Naga
Top achievements
Rank 1
Share this question
or