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

Grid how to save changes from dropdownlist editor

2 Answers 455 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Joe
Top achievements
Rank 2
Joe asked on 09 Mar 2015, 02:20 AM
I have been looking through the examples, but am failing to see how to save the changes back to the server via a custom dropdownlist in my grid.

I am able to get the dropdownlist in the grid and select it from edit mode. Now based on my select I would like to save the changes based on the row record selected.

Is there an example using a template or a full example of this somewhere. Everything I have seen so far has been partial examples.

Here is my editor function which works fine with my grid, just need to know how to make an ajax call or where to make the call to save the change.

    function internalStatusDropDownEditor(container, options) {
        $('<input required data-text-field="InternalStatus" data-value-field="InternalStatus" data-bind="value:' + options.field + '"/>')
            .appendTo(container)
            .kendoDropDownList({
                autoBind: false,
                dataSource: {
                    data: [{ InternalStatus: "Open" }, { InternalStatus: "Closed" }, { InternalStatus: "Pending Input" }]
                }
            });
    }

Thanks all.

2 Answers, 1 is accepted

Sort by
0
Rosen
Telerik team
answered on 11 Mar 2015, 07:11 AM
Hi Joe,

It is not clear what you are trying to achieve. Do you want to save the changes when the DropDownList value is changed? If this is the case you could use the change event to the DropDownList to call the DataSource associated with the Grid sync method. This will push the change to the server (if DataSource is correctly configured).

.kendoDropDownList({        
  change: function() {
    var dataSource = $("#grid").getKendoGrid().dataSource;             
    dataSource.sync();
  },
  dataSource: {
     //...
  }         
});


Regards,
Rosen
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
Joe
Top achievements
Rank 2
answered on 11 Mar 2015, 12:51 PM
Thank you for your reply. I will look further into the DataSource documentation to get it configured correctly to push back to the server.

Any additional links or examples on that portion are always appreciated.

Tags
Grid
Asked by
Joe
Top achievements
Rank 2
Answers by
Rosen
Telerik team
Joe
Top achievements
Rank 2
Share this question
or