Update row data.
Parameters
Name | Type | Description |
---|---|---|
id | {string} | The id of the row that needs to be updated |
record | {object} | Object with data for the new record. |
Examples
sample
<table id="grid"></table>
<script>
var grid;
grid = $('#grid').grid({
primaryKey: 'ID',
dataSource: [
{ 'ID': 1, 'Name': 'Hristo Stoichkov', 'PlaceOfBirth': 'Plovdiv, Bulgaria' },
{ 'ID': 2, 'Name': 'Ronaldo Luis Nazario de Lima', 'PlaceOfBirth': 'Rio de Janeiro, Brazil' },
{ 'ID': 3, 'Name': 'David Platt', 'PlaceOfBirth': 'Chadderton, Lancashire, England' }
],
columns: [
{ field: 'ID', width: 56 },
{ field: 'Name' },
{ field: 'PlaceOfBirth' },
{ title: '', width: 90, align: 'center', tmpl: '<u>Edit</u>', events: { 'click': Edit } }
],
pager: { limit: 2, sizes: [2, 5, 10, 20] }
});
function Edit(e) {
grid.updateRow(e.data.id, { 'ID': e.data.id, 'Name': 'Ronaldo', 'PlaceOfBirth': 'Rio, Brazil' });
}
</script>