Cancel the edition of all editable cells, when the row is in edit mode.
Parameters
Name | Type | Description |
---|---|---|
id | {string} | The id of the row where you need to undo all changes |
Examples
Cancel Row
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet">
<table id="grid"></table>
<script>
var grid, renderer;
renderer = function (value, record, $cell, $displayEl, id) {
var $editBtn = $('<i class="fa fa-pencil gj-cursor-pointer" data-key="' + id + '"></i>'),
$cancelBtn = $('<i class="fa fa-undo gj-cursor-pointer" data-key="' + id + '"></i>').hide();
$editBtn.on('click', function (e) {
grid.edit($(this).data('key'));
$editBtn.hide();
$cancelBtn.show();
});
$cancelBtn.on('click', function (e) {
grid.cancel($(this).data('key'));
$editBtn.show();
$cancelBtn.hide();
});
$displayEl.append($editBtn).append($cancelBtn);
}
grid = $('#grid').grid({
primaryKey: 'ID',
dataSource: '/Players/Get',
inlineEditing: { mode: 'command', managementColumn: false },
columns: [
{ field: 'ID', width: 56 },
{ field: 'Name', editor: true },
{ field: 'PlaceOfBirth', editor: true },
{ width: 56, align: 'center', renderer: renderer }
]
});
</script>