> I select the FileDate from MysQL DB and format it with MySQL function
> DATE_FORMAT
> 
> Select ... 
> DATE_FORMAT(B.FileDate, '%d.%m.%Y %k:%i:%s') AS FileDate
> from table ..
> ..
> $recordset[] = array($color,$row['FileName'],$file_kb,$row['FileDate']  );
> ..
> echo json_encode($recordset);
> 
> Do you mean I have to "translate" the "FileDate" at data.php into a JS Date
> format?

Not quite. I was thinking of the client side where you receive the data:

>                      var content = e.getContent();
>                      if (content.length > 0) {
>                               tableModel.setData(content);
>                      }//if


Right now you're just pushing the data that comes from the server right
through to the table model. What I recommended was something like this
instead:

  var content = e.getContent();
  var row;
  var dateFormat = new qx.util.format.DateFormat("dd.MM.yyyy HH:mm:ss");
  for (var i=0; i<content.length; i++) {
    row    = [];
    row[0] = content[i][0];
    row[1] = content[i][1];
    row[2] = dateFormat.parse(content[i][2]);
    tableModel.addRows([row]);
  }

You handle each data row and push it to the model individually. That
gives you the opportunity to transform individual data items. My code
snippet assumes that the $row['FileDate'] field sent from the server is
actually a string, in the format as you listed in your initial mail.

To turn that into a JS Date object I used a qooxdoo utility class,
qx.util.format.DateFormat. I created an instance of this class, passing
the expected string format, and then used it to parse the data coming
from the server into a proper Date object (that's what e.g.
dateFormat.parse("01.03.2010 10:49:22") would return).

Of course, if you could return seconds-since-the-epoch from the server,
that would be superfluous, and could be replaced by the much faster
"row[2] = new Date(content[i][2]);". So there is maybe an optimization
option in this aspect.

Is that any clearer?

T.


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to