:: Forum >> Version 1 >>

Refresh after setRowProperty("count") causes error in IE

Hi,

Im using 1.0. I made a function to delete rows:
function dataGrid_deleteRows(oDatagridaDatagridData)
{   
  
selectedRows oDatagrid.getSelectionProperty("values"); //get selected rows
  
  
for (i=selectedRows.length-1i>=0i--) //delete rows, starting by the last selected row
  
{      
    
aDatagridData.splice(selectedRows[i], 1)
  }
  
  
oDatagrid.setRowProperty("count"aDatagridData.length);  //set new row count
  
oDatagrid.refresh(); //refresh the table
  
oDatagrid.setSelectionProperty("index"null);  //clear selection
}
 
which works fine in FF, but is causing trouble in IE6. In IE i get a error about aDatagridData, which doesnt exist according to IE.

When i remove

oDatagrid.setRowProperty("count"aDatagridData.length);   the script works fine, but I have to use this function in order to get the desired functionality.

Anybody an idea how to fix?
Rekcor
Saturday, August 26, 2006
Maybe using a new var ?
function dataGrid_deleteRows(oDatagridaDatagridData
{    
  
selectedRows oDatagrid.getSelectionProperty("values"); //get selected rows 

   
var ERASED 0;

  for (
i=selectedRows.length-1i>=0i--) //delete rows, starting by the last selected row 
  
{       
    
aDatagridData.splice(selectedRows[i], 1
ERASED ++
  } 
   
  
oDatagrid.setRowProperty("count"aDatagridData.length ERASED );  //set new row count 
  
oDatagrid.refresh(); //refresh the table 
  
oDatagrid.setSelectionProperty("index"null);  //clear selection 
}  
Carlos
Saturday, August 26, 2006
Thanx, but that doesn't work, as aDatagridData.length is the length of the array in

oDatagrid.setRowProperty("count"aDatagridData.length ERASED );  //set new row count
 
so (aDatagridData.length - ERASED) is too short.

The very strange thing is that

oDatagrid.setRowProperty("count"aDatagridData.length [b]- 1[/b]);  //set new row count 
  
oDatagrid.refresh(); //refresh the table  
 
works in IE, but not in FF.

In FF, the last element of the array is deleted as well, which is logical, because I'm saying to the script the aDatagridData's length is 1 shorter than its actual size...
Rekcor
Saturday, August 26, 2006
mmm... and dont work inside a [ code ] tag here
Rekcor
Saturday, August 26, 2006
:lol:

what i meant to say: the bold tag doesnt work inside of the code tag, so it should be:

"The very strange thing is that

oDatagrid.setRowProperty("count"aDatagridData.length 1);  //set new row count 
  
oDatagrid.refresh(); //refresh the table   
works in IE, but not in FF.

In FF, the last element of the array is deleted as well, which is logical, because I'm saying to the script the aDatagridData's length is 1 shorter than its actual size..."
Rekcor
Saturday, August 26, 2006
I found out!

The fault was in my aDatagridData. The first time the table grid is filled with data goes like this

ar testlijst_data = [
[
"80""Cardamine lyrata""5 cm post""13""4.35""0""0"],
[
"170""Hygrophyla stricta tai""5 cm pot""24""1.9""0""0"],
];
 
The last comma (,) was the killer in this case

aArray = [1,2,3,]
alert (aArray.length//will display 3 in FF, 4 in IE

bArray = [1,2,3]
alert (bArray.length); //will display 3 in both FF and IE
 
Thanx anyway!
Rekcor
Saturday, August 26, 2006



This topic is archived.

Back to support forum

Forum search