0
votes

On my Kendo grid, I have "editable=true" and datasource with "autoSync=true". As I click on a cell, it becomes editable and when leaving the cell it executes the transport's update event.

That's all fine.

In the update event I have access to the row of the dataset model containing all the values of the modified row (although with editable=true and autosync, only one column value would have been modified).

I need to know which column / field was modified?

Ideally I thought that info would be in the arguments (options) supplied to the update event.

dataSource = new kendo.data.DataSource({
        autoSync: true,
        transport: {
           update: function (options) {
             // options does not tell me which model field was updated?
             ...

But since it isn't there, I suppose I need to bind to the model's set event, but I cannot get that to work.

Any ideas?

1

1 Answers

0
votes

Never mind this answer! I read the question all wrong.

I think I got it working the way you like.

Is this jsFiddle what you're looking for?

var ds = new kendo.data.DataSource({
    autoSync: true,
    transport: {
        read: function(options) {
            options.success([
                { Id: 1, A: 'Hello', B: 'World' },
                { Id: 2, A: '1', B: '2' },
                { Id: 3, A: 'fdasf', B: '4523' }
            ]);
        },
        update: function (options) {
            var uid = ds.data().find(function(p) {return p.Id == options.data.Id;}).uid;
            var tr = $('#grid .k-grid-content tr[data-uid="'+uid+'"]');
            console.log(tr);
            //Do something with tr
        }
    },
    schema: {
        model: { id: "Id" }
    }
});

$('#grid').kendoGrid({
    dataSource: ds,
    editable: true,
});