Rob,
Why do you have nil elements in your grid?
Nico
Le dimanche 06 avril 2008 à 15:25 -0400, Rob Rothwell a écrit :
> I got tired of my application failing if I tried to sort a WebGrid
> column with some nil elements, so I have created two methods:
>
> WebGrid>>standardAscendingSortBlockForColumn: column
> ^[:a :b|
> | val1 val2 |
> val1:=a perform: column aspect.
> val2:=b perform: column aspect.
> val1 isNil
> ifTrue: [true]
> ifFalse: [val2 isNil
> ifTrue: [false]
> ifFalse: [val1 < val2]]]
>
> and
>
> standardDescendingSortBlockForColumn: column
> ^[:a :b|
> | val1 val2 |
> val1:=a perform: column aspect.
> val2:=b perform: column aspect.
> val1 isNil
> ifTrue: [false]
> ifFalse: [val2 isNil
> ifTrue: [true]
> ifFalse: [val1 > val2]]]
>
>
> (There is probably a more compact way to do this if I was more
> experienced)
>
> and have altered:
>
> WebGrid>>sortColumnsIfNessesary
> | column sortBlock |
> self sortColumn isNil ifTrue: [^nil].
> column := self columns at: self sortColumn.
> sortBlock := (self sortOrder = #ascending)
> ifTrue: [ self standardAscendingSortBlockForColumn: column ]
> ifFalse: [ self standardDescendingSortBlockForColumn:
> column ].
> self collection: (SortedCollection withAll: self collection
> sortBlock: sortBlock).
>
> Is this generally useful to Aida, or should it just be a WebGrid
> subclass like WebDataGrid?
>
> I also have a WebGrid>>bindTo: method which will bind a WebGrid to an
> ODBCResultTable. Would database components be generally useful to
> anyone else? Probably not, unless you are planning on writing a
> DbVisualizer type of thing in Smalltalk (which I was thinking of doing
> as a more "business oriented" example).
Can you explain a bit more please ?
Nico
>
> This leads me to ask about future component naming conventions if
> people start contributing separately packaged Aida components. Would
> you envision something like
>
> Aida-Database
> or
> Aida-Database Components
> or
> Aida-Components-Database?
>
> Just wondering. It would be great if the Aida Squeaksource would
> become a repository for new components that could be plugged in to
> your application as needed!
>
> Rob
> _______________________________________________
> Aida mailing list
>
Aida@...
>
http://lists.aidaweb.si/mailman/listinfo/aida _______________________________________________
Aida mailing list
Aida@...
http://lists.aidaweb.si/mailman/listinfo/aida