3.2.0

Date format problem

What's wrong in this date/time format ?
It doesn't work, the date column is still recognized like a string.

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Prova ActiveWidgets</title>
<link href="aw/styles/system/aw.css" rel="stylesheet" type="text/css" ></link>
<script src="aw/lib/aw.js"></script>
<style>

html { width: 100%; height: 100%; margin: 0px; padding: 0px; overflow: hidden}
body { width: 100%; height: 100%; margin: 0px; padding: 50px; overflow: hidden; font: menu}

</style>

<script>
window.focus();
</script>
</head>
<body>
<h1>Prova</h1>
<script>
var myCells = eval('[{"id":8,"dataora":"12-12-2008T07:12:45+01:00"},{"id":9,"dataora":"12-12-2008T07:12:45+01:00"},{"id":9,"dataora":"12-12-2008T07:12:45+01:00"},{"id":10,"dataora":"12-12-2008T07:12:45+01:00"},{"id":20,"dataora":"12-12-2008T07:12:45+01:00"},{"id":21,"dataora":"12-01-2008T11:01:08+01:00"},{"id":22,"dataora":"12-12-2008T07:12:45+01:00"},{"id":23,"dataora":"12-12-2008T07:12:45+01:00"},{"id":24,"dataora":"12-12-2008T07:12:45+01:00"},{"id":25,"dataora":"12-12-2008T07:12:45+01:00"},{"id":36,"dataora":"12-12-2008T07:12:45+01:00"},{"id":37,"dataora":"12-12-2008T07:12:45+01:00"},{"id":38,"dataora":"12-12-2008T07:12:45+01:00"},{"id":39,"dataora":"12-12-2008T07:12:45+01:00"},{"id":40,"dataora":"23-01-2008T11:01:08+01:00"},{"id":41,"dataora":"12-12-2008T07:12:08+01:00"},{"id":42,"dataora":"12-12-2008T07:12:45+01:00"},{"id":43,"dataora":"12-12-2008T07:12:45+01:00"},{"id":44,"dataora":"12-12-2008T07:12:45+01:00"},{"id":45,"dataora":"12-12-2008T07:12:45+01:00"}]');
var obj = new AW.UI.Grid;

obj.setSize(800,400);
obj.setCellText(myCells);
obj.setHeaderText({id:"Chiave",dataora:"Bubbone"});
var vNumeri = new AW.Formats.Number;
var vStringhe = new AW.Formats.String;
var vDate = new AW.Formats.Date;
vDate.setDataFormat("ISO8601");
vDate.setTextFormat("dd/mm/yyyy hh:mm");
obj.setCellFormat({id:vNumeri,dataora:vDate});
obj.setColumnIndices(["id","dataora"]);
obj.setColumnCount(2);
obj.setRowCount(myCells.length);
document.write(obj);
</script>
</body>
</html>
Avelco - Massimiliano
December 18,
I'm not sure I understand why you've gone to the trouble of using JS associative arrays rather than just normal JS arrays. I'd start by simplifying that. I.e. change myCells to -
var myCells =
[
[8, "12-12-2008T07:12:45+01:00"].
[9, "12-12-2008T07:12:45+01:00"],
etc. ...
]

then obj.setHeaderText(["Chiave", "Bubbone"]) and obj.setCellFormat() (I suspect that might be your problem. I don't think AW handles JS assoc. arrays).

Also, is the call to setColumnIndicies() correct? Check its arguments.
Anthony
December 20,
http://www.activewidgets.com/aw.formats.date/setdataformat.html
December 20,

This topic is archived.

See also:


Back to support forum