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

Kendo Grid Column - Custom Editor

1 Answer 95 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Shako
Top achievements
Rank 1
Shako asked on 08 May 2014, 11:43 AM
Hello Guys,
I have some problems with Kendo Grid Column Update:

1) I have grid which is this:
            grid.kendoGrid({
                dataSource: dataSource,
                toolbar: [
                    { text: "Save Changes", className: "update_sportsgid", imageClass: "k-update" }
                ],
                columns: ["id",name", { field: "enabled", title: "Status", editor: statusEditor },],
                editable: true
                }
            });

2) Column named "enabled" in that grid has custom editor with ComboBox and function for that editor is this:
            function statusEditor(container, options) {
                var selOptions = '<option value="Enabled">Enabled</option><option value="Disabled">Disabled</option>';
                
                var input = $("<select name="+options.field+">"+selOptions+"</select>");
                
                input.appendTo(container);
                input.kendoComboBox();
            }

3) In the grid i have toolbar which has class "update_sportsgid" and i attach click event on that toolbar button:
            $('.update_sportsgid').click(function (e) {
                e.preventDefault();
                me.updateSportsGrid(grid);
            });


4) When toolbar button is click i call update function:
updateSportsGrid: function (grid) {
           //Get Whole Displayed Data
           var displayedData = grid.data().kendoGrid.dataSource._data;
           var dataToSend = [];

            //Iterate over grid and get changed row values
            for(var i = 0;i<displayedData.length;i++) {
                var current = displayedData[i];
                if(current.dirty) {
                    var node = {
                        id:current['id'],
                        type:"Sport",
                        priority:current['priority'],
                        enabled:current['enabled'],
                        topBets:current['topBets']
                    }
                    dataToSend.push(node);
                }
            }

The problem is that when i change column with custom editor "ComboBox" column doesn't change and row doesn't have dirty value true.
How can i bind custom editor to change data of grid view?






1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 10 May 2014, 09:59 AM
Hello Shako,

This happens because the select element is missing the data-bind attribute which is responsible for the value binding. I would recommend checking this demo as well as this example.

Regards,
Alexander Popov
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
Shako
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or