. .

smalltalkDaily

Smalltalk Daily 08/19/10: Customizing a WebVelocity Query

August 19, 2010 9:43:36.633

Today's Smalltalk Daily looks at how you can customize a query for one of the standard scaffolding UIs in WebVelocity. The code added is all in class NoteListUI. To jump to the video, Click here If you can't see the embedded video directly, you can go directly to YouTube for it.

First, add a variable, searchText


renderActionsOn: html
	super renderActionsOn: html.
	html text: 'Search'.
	html space.
	html textInput on: #searchText of: self.
	html button
		callback: [self applySearch];
		value: 'Search'.
	html button
		callback: [self returnToAll];
		value: 'All'

applySearch
	"do the search"
	
	| query newSearchText |
	query := Glorp.ActiveRecords.Query read: Note.
	newSearchText := '%', self searchText asLowercase, '%'.
	query where: [:each | each title asLowercase like: newSearchText].
	paginator query: query.

returnToAll
	| query |
	query := Glorp.ActiveRecords.Query read: Note.
	paginator query: query.

Click on the viewer below to watch it now:

You can follow the Smalltalk channel on YouTube for all the "Smalltalk Daily" videos. You can also check out the videos on Vimeo, where the quality is higher, or over on Facebook, if you are a member.

You can download the video directly here. If you need the video in a Windows Media format, then download that here. If you like this kind of video, why not subscribe to "Smalltalk Daily"?

Technorati Tags: , , ,

posted by James Robertson

 Share Tweet This