简体   繁体   中英

how to update grid row silently in Kendo UI?

I am calling a Web API using AJAX to get the latest data for a selected record as below:

$.ajax({ 
    type: 'Get',
    url: _apiPath + "DataEntry/" + e.model.id,
    async: false,
    contentType: "application/json",
    success: function (data) {
        $.each(e.model.fields, function (index, value) { 
            if (data[index] != null) {
                e.model.set(index, data[index]);                                                
            }
        });
    }});
}

Its getting the data correctly. But when updating the data into the model, its not working sometimes. Also it adds a red triangle to the corner of the cell. Is there a better way to do this? I already tried datasource.Sync(). But my requirement is to update single row without triggering any other code. Any thoughts?

If I understand what you are asking correctly then try datasource.read()

datasource.sync() is used to save any data item that has changed

datasource.read() reads all the data items from whatever remote service you have or from javascript array

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM