[Seaside] Help understanding WATableReport

LK s002 at landr.net
Fri Aug 27 14:29:39 CEST 2004


Kamil Kukura wrote:

>
>>> Date today yyyymmdd
>>>
>>> (you should really learn how to find such answers yourself. Is it that
>>> hard to open browser on class Date and look what methods are there?)
>>
>>
>> No, it's not. And that is precisely what I spent several hours doing. 
>> The only method that I could get to work through seaside was 
>> #asString. So, I thought that there must be some magic that only the 
>> experts know about. Clicking on the Sort link above my date or time 
>> columns returns a ' Dates are not indexable' error. I inferred from 
>> this, that dates could not be sorted. Converting them to strings 
>> removed the error, which re-inforced my belief.
>
>
> From your question it was not clear as for what purpose you want to 
> convert date to string. If you get an error, try to examine walkback 
> and post it here or to squeak-dev mailing list if it is more general 
> thing.
>
For some reason, when I retrieve my dates from GOODS storage, I must 
explicitly convert it to a Date to get it to behave the way is should.

PMLogItem>>initialize
entryText := Date today.
---
PMLogsTableReport>>BuildTable
^WATableReport new
rowPeriod: 1;
rowColors: #('white' 'lightbrown');
rows: self session logs ;
columns: (OrderedCollection new
add: (WAReportColumn new valueBlock: [:ea| (ea entryDate asDate) 
yyyymmdd]; title: 'Date');
" this does not work:
add: (WAReportColumn new valueBlock: [:ea| ea entryDate yyyymmdd]; 
title: 'Date');
"
yourself)

>> I can see that #sortBlock: assigns an object. But, what does that 
>> object have to look like to make a WAReportColumn sortable? Something 
>> that is intuitively obvious for an expert, is frustratingly obtuse to 
>> a novice. But, you must be getting tired of dealing with novices, so 
>> I'm not expecting a reply. Thank you. You have been a great help so far.
>> -Larry
>
>
> Feel free to ask question as why 2 plus 2 is 4. I witnessed that even 
> masterful developers have hard times to answer simple questions. But 
> in your case there must be something that needs to be brought to the 
> light. Date is derived from Magnitude and is then sortable: "Date 
> tomorrow > Date today". You can try with SortedCollection:
>
> sc _ SortedCollection new.
> sc addAll: {Date tomorrow. Date today}.
>



More information about the Seaside mailing list