[Seaside] AutoCompleter

Edward Stow ed.stow at gmail.com
Fri Apr 18 21:12:15 UTC 2008


On Sat, Apr 19, 2008 at 1:43 AM, John Thornborrow <john at pinesoft.co.uk> wrote:
>
>
>  Pinesoft Limited are registered in England, Registered number: 2914825. Registered office: 266-268 High Street, Waltham Cross, Herts, EN8 7EA
>
> 'From Squeak3.10beta of 22 July 2007 [latest update: #7159] on 18 April 2008 at 4:42:10 pm'!
>  WAComponent subclass: #Blah
>         instanceVariableNames: 'text'
>         classVariableNames: ''
>         poolDictionaries: ''
>         category: 'MyStuff'!
>
>  !Blah methodsFor: 'data' stamp: 'jmt 4/18/2008 16:37'!
>  list
>         ^ OrderedCollection new
>                 add: 'foo';
>                 add: 'bar';
>                 add: 'foobar';
>                 add: 'supercalifragalisticexpialidocious';
>                 add: 'antidisestablishmentarianism';
>                 yourself! !
>
>  !Blah methodsFor: 'data' stamp: 'jmt 4/18/2008 16:35'!
>  listItems
>         ^ self list select: [ :each | each includesSubstring: text caseSensitive: false ]! !
>
>
>  !Blah methodsFor: 'rendering' stamp: 'jmt 4/18/2008 16:41'!
>  renderContentOn: html
>         html textInput
>                 id: 'text';
>                 callback: [ :x | text := x ];
>                 value: text.
>         html div
>                 class: 'autocomplete';
>                 script: (html autocompleter
>                         element: 'text';
>                         assignTo: 'auto';
>                         onSelected: (html request
>                                 callback: [ :value | (self listItems at: (value asInteger + 1)) inspect ]
>                                 value: (html autocompleter alias: 'auto'; selectedIndex));
>                         on: #renderListOn: of: self)! !
>
>  !Blah methodsFor: 'rendering' stamp: 'jmt 4/18/2008 16:36'!
>  renderListOn: html
>         html unorderedList list: self listItems! !
>
>  "-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- "!
>
>  Blah class
>         instanceVariableNames: ''!
>
>  !Blah class methodsFor: 'as yet unclassified' stamp: 'jmt 3/25/2008 12:49'!
>  canBeRoot
>         ^ true! !
>
This works a treat -- is there some way for code snippets like these
to be harvested and included in seaside.st or some other support site.

-- 

Edward Stow


More information about the seaside mailing list