:: Forum >>

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
Thursday, July 1, 2004
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
Thursday, July 1, 2004
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
Monday, July 5, 2004
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
Friday, July 30, 2004
What's the code to add a row?

Gran
Gran
Monday, September 26, 2005
I'd like to see the code to add a row as well.

Thanks. lw
lw
Wednesday, December 7, 2005
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
Wednesday, December 7, 2005

This topic is archived.


Back to support forum

Forum search