See my other post today ("Date Format"). The basic table demo also shows
how to set a cell renderer:
http://demo.qooxdoo.org/current/demobrowser/#table~Table.html

T.

On 03/16/2010 02:56 PM, Qoodary wrote:
> 
> Hello Thron,
> 
> sorry for the delayed answer. I had not time to test your ideas until today.
> I tried to change the code, filling my table from;
> tableModel.setData(content);
> to this:
> 
> var content = e.getContent();
> if (content.length > 0) {
>       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] = content[i][2];
>               row[3] = dateFormat.parse(content[i][3]);
>               tableModel.addRows([row]);
>       }
> }//if
> 
> Now I can sort the date correct in the table column "Date". 
> But, there is not longer the time?
> There is only the date in this format:
> 
> 31.01.2010
> 
> the original date time comming from the mysql database was:
> 31.01.2010 12:06:50
> 
> Any idea why there is no time in the column?
> 
> thanks a lot
> Hansjoerg
> 
> 
> 
> 
> thron7-2 wrote:
>>
>>> 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
>>
>>
> 

------------------------------------------------------------------------------
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