3.2.0

date formatting

Shouldn't this give me a formatted date?

<script>


var myData = [['1218', '1387', 'Louis', 'Testlouis', '09/11/2004', '&nbsp;', '1', '0', '8', '&shy;', 'dumbo@cox.net', '&shy;', 'f', '1437658946']
]
;
var myColumns = ['aid', 'id', 'fname', 'lname', 'datecompleted', 'remarks', 'rank', 'scweight', 'aweight', 'hiredate', 'email', 'essential', 'commentmade', 'homephone']
;

var obj = new AW.UI.Grid;
var str = new AW.Formats.String;
var num = new AW.Formats.Number;
var date = new AW.Formats.Date;

date.setDataFormat("default");
date.setTextFormat("mmm-dd-yyyy");

obj.setCellFormat([num, num, str, str, date, str, num, num, num, str, str, str, str, str])

//provide cells and headers text
obj.setCellText(myData);
obj.setHeaderText(myColumns);

//set number of rows/columns
obj.setRowCount(1);

obj.setColumnCount(14);

//enable row selectors
obj.setSelectorVisible(false);
obj.setSelectorText(function(i){return this.getRowPosition(i)+1});

//set headers width/height
obj.setSelectorWidth(28);
obj.setHeaderHeight(20);

obj.setVirtualMode(true);

//set row selection
obj.setSelectionMode("single-cell");

//set click action handler
obj.onCellClicked = function(event, col, row){window.status = this.getCellText(col, row)};



obj.setCellEditable(true);

document.write(obj);

</script>
Patrick
August 29,
No. If you call setCellText(array) then the array text goes into the grid cells as it is. You should use setCellData(array) - in this case 'data' string is converted to 'text' using dataToText() method from the format object.
Alex (ActiveWidgets)
August 29,

This topic is archived.

See also:


Back to support forum