how I can delete a row from a javascript function from a button for example
A:
Suppose you are using jQuery
var grid;
$(function () {
// init options, load data
...
var columns = [];
columns[0] = {
id: 'id',
name: '#',
field: 'id', // suppose you have an id column in your data model
formatter: function (r, c, id, def, datactx) {
return '<a href="#" onclick="RemoveClick(' + id + ',' + r + ')">X</a>'; }
}
// init other columns
...
grid = new Slick.Grid($('#gridDiv'), data, columns, options);
}
function RemoveClick(databaseId, gridRow) {
// remove from serverside using databaseId
...
// if removed from serverside, remove from grid using
grid.removeRow(gridRow);
}
m0sa
2010-10-14 09:14:09
A:
hi i'm used this script for delete row of SlickGrid
function deletefila(numrow) {
alert("delete row"+numrow);
data.splice(numrow,1);
grid.removeAllRows();
grid.render();
//grid.removeRow(5);
//grid.updateRowCount();
//and then invalidate and re-render the grid by calling grid.removeAllRows() followed by grid.render().
}
Gerardo Pacheco
2010-10-18 00:12:19