DateFormat is not working in GRID

I have following code and date format in display of grid is not working,
Can any one guess what's happening?

function addrowsX(date){
for (var i = 0; i < 10; i++)
          var schedulePeriod = i + 1;
          var startDate = new Date(date);
          startDate.setMonth(startDate.getMonth() + i);
          var endDate = new Date(startDate);
          endDate.setMonth(endDate.getMonth() + 1);
          endDate.setDate(endDate.getDate() -1);
          grdSwapSchedule.data[grdSwapSchedule.data.length] = [0,schedulePeriod, startDate, endDate, 'N'];
          grdSwapSchedule.addRow(grdSwapSchedule.data.length - 1);

Also I have common code where i m formating cell as following:
 * Converts the specified table to an Active Widgets grid.
function convertTable(table)
  var dateFormat = new AW.Formats.Date();

  var numberFormat = new AW.Formats.Number();
  var stringFormat = new AW.Formats.String();

  var columns              = new Array();
  var formats              = new Array();
  var displayColumnIndices = new Array();

  var headerRow = table.rows[0];

  for (var i = 0; i < headerRow.cells.length; i++)
    columns[i] = headerRow.cells[i].innerHTML;

    if (headerRow.cells[i].getAttribute('format') == 'date')
      formats[i] = dateFormat;
    else if (headerRow.cells[i].getAttribute('format') == 'number')
      formats[i] = numberFormat;
      formats[i] = stringFormat;

    if (headerRow.cells[i].className != 'hidden')
      displayColumnIndices[displayColumnIndices.length] = i;

  var rowClickListeners       = new Array();
  var rowDoubleClickListeners = new Array();
  var tooltips                = new Array();
  var data                    = new Array();

  //Fixes bug where empty data causes a bug when adding new rows.
  var deleteFirstRow = true;
  data[0] = new Array();
  for (var i = 0; i < columns.length; i++)
    data[0][i] = '';

  for (var rowIndex = 1; rowIndex < table.rows.length; rowIndex++)
    deleteFirstRow = false;

    var row = table.rows[rowIndex];

    data[rowIndex - 1] = new Array();
    for (var colIndex = 0; colIndex < row.cells.length; colIndex++)
      data[rowIndex - 1][colIndex] = row.cells[colIndex].innerHTML;

    if (row.getAttribute('tooltip'))
      tooltips[rowIndex - 1] = row.getAttribute('tooltip');

    rowClickListeners[rowIndex - 1] = row.onclick;

    if (row.getAttribute('onclick'))
      rowDoubleClickListeners[rowIndex - 1] = new Function('event', 'index', row.getAttribute('onclick'));

    if (row.getAttribute('ondoubleclick'))
      rowDoubleClickListeners[rowIndex - 1] = new Function('event', 'index', row.getAttribute('ondoubleclick'));

  var grid = new AW.UI.Grid();
  grid.data = data;
  grid.setVirtualMode(table.getAttribute('virtual') != 'false');

  grid.tooltips = tooltips;
  grid.setCellTooltip(function(col, row){return this.tooltips[row] ? this.tooltips[row] : '';});
  if(table.getAttribute('headerSorting') == 'false') grid.onHeaderClicked = function(){ return true;};
  grid.rowClickListeners = rowClickListeners;
  grid.onRowClicked = function(event, index){if (this.rowClickListeners[index]) this.rowClickListeners[index](event, index);};
  grid.onRowShiftClicked = function(event, index){if (this.rowClickListeners[index]) this.rowClickListeners[index](event, index);};

  grid.rowDoubleClickListeners = rowDoubleClickListeners;
  grid.onRowDoubleClicked = function(event, index){if (this.rowDoubleClickListeners[index]) this.rowDoubleClickListeners[index](event, index);};
  grid.onRowShiftDoubleClicked = function(event, index){if (this.rowDoubleClickListeners[index]) this.rowDoubleClickListeners[index](event, index);};

  var parentNode = table.parentNode;
  parentNode.innerHTML = grid;

  //See work around for bug detailed above.
  if (deleteFirstRow)
    grid.setRowState('deleted', 0);

  //DO NOT MOVE THIS - setting it before the grid is displayed causes an error - NH 4/2007.

  return grid;

and HTML code is below.


                        <th format="number">id</th>
                        <th format="number">Scheduled Period</th>
                        <th format="date">Start Date</th>
                        <th format="date">End Date</th>
                        <th>Extra Ordinary Period</th>

Naresh C
May 20,
Can Any one help, I am having hard time....
Naresh C
May 20,
NOTE: 'MMM' is not included in format pattern tokens ?
May 20,
Even "dd-mmm-yyyy" doesn't work for me. not sure what is the problem with the grid. I make a work around although not a good thing but setting date as string in above format and unformating string and create javascript date when sending to server. what can I do !!!

If you can help me to sort out this issue i will be very thankful to you.
Also in above code convertTable(table) called on html onload function which return grdSwapSchedule grid..

Naresh C
May 21,

This topic is archived.

See also:

Back to support forum


Version 2

Looking for AW 2.6 ?
The old site is here.