Crab Log

Batched List Hack

Maio 30, 2008 · Deixe um comentário

Neste hack colocamos alguns códigos que podem esclarecer como usar o componente WABatchedList no Seaside. Primeiro crie a classe de teste com:

WAComponent subclass: #BatchedListHack

instanceVariableNames: ‘items batchedlist’

classVariableNames:

poolDictionaries:

category: ‘Seaside-Hacks’

Depois implemente os seguintes métodos:

initialize
super initialize.
items := OrderedCollection new.
1
to: 100
do: [:k | items add: 'item ' , (k asString padded: #left to: 3 with: $0)].
batchedlist := WABatchedList new.
batchedlist batchSize: 15.
batchedlist items: items

renderContentOn: html

html heading: ‘Batched List Test’.

batchedlist batch

do: [:item |

html render: item.

html break].

html render: batchedlist

children

^ Array with: batchedlist

A página gerada é como abaixo:

Categorias: Smalltalk
Etiquetado: ,

0 respostas Até agora ↓

  • Ainda não há comentários... chute o balde preenchendo o formulário abaixo.

Deixe um comentário