Kobi
Kobi

Reputation: 201

How to edit row of Telerik MVC grid in Javascript

I am trying to edit a cell's innerText property. The text is shown in the table but the problem is that the row isn't being marked as updated, so when I press my "Save Changes" button the update method doesn't get this row (in the list of rows to update).

I am trying to use this method (updateRow) but so far it has been unsuccessful:

var grid = ("#grid").data("tGrid");
var rowToUpdate = grid.data[0];
rowToUpdate.quantity = 4;
grid.updateRow(rowToUpdate);

When the method is called I get the following exception:

"object does not support this property or method".

in the source of telerik. Does anyone know how to mark a row as updated? Or a better way to update the value of cell in row?

Upvotes: 1

Views: 2933

Answers (1)

moribvndvs
moribvndvs

Reputation: 42497

You can use the client-side method updateRow to force updating. The key is selecting the table row you wish to update, as indicated in their example (of course, you don't have to use their $('#Grid .t-grid-edit-row') selector; you can use any selector, so long as it selects the row you wish to update). I believe that your modifying of the cell's innerHTML/innerText to communicate the new value is how its done.

Upvotes: 3

Related Questions