:: Forum >>
Bad date copying when adding and removing a row: formatting problems?
Hello everybody,
i am writing a simple page with active widget. My page mi composed of 2 grid and my aim is to move rows from one grid to the other.
Grid contents are both text and date (necessary for a nice sorting feature).
I've seen that date content (in gg/mm/aaaa format) are copied wrongly...is it a formatting problem? (eg 28/10/2005 becomes 10/4/2007).
I've printed out (with alert() function) the content of dataToAdd and it seems ok, so I suppose the problem arises when I past date into the second grid.
If so, how I can tell to the grid that my date format is gg/mm/aaaa
Below there is a part of my code:
function addRow(idx){
if (idx>=0) {
//save the row content of the 1st grid
var dataToAdd = [
cacheTable0.getProperty("data/text", idx, 0),
cacheTable0.getProperty("data/text", idx, 1),
cacheTable0.getProperty("data/text", idx, 2),
cacheTable0.getProperty("data/text", idx, 3),
cacheTable0.getProperty("data/text", idx, 4),
cacheTable0.getProperty("data/text", idx, 5),
cacheTable0.getProperty("data/text", idx, 6),
cacheTable0.getProperty("data/text", idx, 7),
cacheTable0.getProperty("data/text", idx, 8),
cacheTable0.getProperty("data/text", idx, 9),
cacheTable0.getProperty("data/text", idx, 10),
cacheTable0.getProperty("data/text", idx, 11),
cacheTable0.getProperty("data/text", idx, 12),
cacheTable0.getProperty("data/text", idx, 13)
];
//add the row to the second grid
myData1.unshift(dataToAdd);
//re-compute 2nd grid capacity and properties
cacheTable1.setRowProperty("count", myData1.length);
cacheTable1.setDataProperty("count", myData1.length);
var newCount = cacheTable1.getDataProperty("count");
var rowValues = [];
for(var i=0; i < newCount; ++i) { rowValues.push(i); }
cacheTable1.setRowProperty("values", rowValues);
cacheTable1.setSortProperty("index", null);
//2nd grid refresh
cacheTable1.refresh();
//remove the row from the 1st grid
returnVal = myData0.splice(idx,1);
//re-compute 1st grid capacity and properties
cacheTable0.setRowProperty("count", myData0.length);
cacheTable0.setDataProperty("count", myData0.length);
var newCount = cacheTable0.getDataProperty("count");
var rowValues = [];
for(var i=0; i < newCount; ++i) { rowValues.push(i); }
cacheTable0.setRowProperty("values", rowValues);
cacheTable0.setSortProperty("index", null);
//1st grid refresh
cacheTable0.refresh();
}
}
Thank you in advance
Simone Tiberia
Friday, October 28, 2005
This topic is archived.
Back to support forum
Forum search