Problem to remove line of the GRID
I am removing a line of the GRID (removeRow). Only that the line of the array myData that fills grid is not extinguished. Somebody has some tip?
Marlon Domingos
July 1,
This solution does not remove myData (variavel that popula the GRID):
function removeRow(obj, btnOnclick) {
if(btnOnclick != null) {
var srow = obj.getProperty("selection/index");
if(srow != '-1') {
var nrow = obj.getProperty("row/count");
var thisRowB = obj.getProperty("row/values",nrow);
var thisRow=[];
var ind,k=0;
obj.setProperty("selection/index",-1);
if (nrow==1) thisRow='';
if (srow!=-1 && nrow>0) {
for (i=0;i<nrow-1;i++) {
if (thisRowB[i]==srow) {
k++;ind=i
}
thisRow[i]=thisRowB[i+k];
alert(thisRow[i]);
}
obj.setProperty("row/values",thisRow);
obj.setRowCount(nrow-k);
obj.setRowProperty("count", nrow-1);
obj.setProperty("selection/index", -1);
obj.refresh();
}
} else alert('it does not have no element selected in grid.');
}
}
Marlon Domingos
July 1,
when I addRow
later I removeRow
later I addRow
later I removeRow
GENERATES the FOLLOWING EXCEPTION: myData[... ] is null or not an Object Please!
Help...
Marlon Domingos
July 5,
Solution...
function removeRow(grid) {
var index = grid.getProperty("selection/index");
if(index != '-1') {
if (confirm("Você tem certeza que deseja excluir?")) {
_removeRow(grid, index);
var lastRow = grid.getProperty("row/count");
if(lastRow == 0) addNewRow(grid);
grid.setProperty("selection/index", lastRow-1);
}
} else alert('Não há nenhum elemento selecionado.');
}
thank´s.
Marlon Domingos
July 30,
What's the code to add a row?
Gran
Gran
September 26,
I'd like to see the code to add a row as well.
Thanks. lw
lw
December 7,
Hey, Here is a way to add a line to the grid:
function addRow(obj2)
{
var rownum = obj.getRowProperty("count");
obj.setRowProperty("count", rownum+1);
obj2.refresh();
}
lw
December 7,