These are indexes of the first five celebrities in collection. The propertyModel
parameter was null, so no specific sorting was requested. Finally, the getRowValue
method was invoked five times to obtain an object to be displayed by each of the five
rows in the table.
Click on the pager to view the second page of results and the result will be similar,
only the indices will be different:
Preparing selection.
Index from 5 to 9
Property name is: null
Sorting order ascending: true
Getting value for row 5
Getting value for row 6
Getting value for row 7
Getting value for row 8
Getting value for row 9
Click on the header of one of the columns, and you will see the change in the
property name passed to the prepare method:
Property name is: lastName
Sorting order ascending: true
Now the data source will be requested to sort the result by last name. Of course, no
sorting will take place in our simplified example as we are simply outputting the
name of the property and not using it in an actual request to a database.
Chapter 5
[ 139 ]
Click on the same column once again, and this time you will see that the order of
sorting is changed:
Property name is: lastName
Sorting order ascending: false
You can see from this example that Tapestry allows us to define precisely how
a database (or other data source) should be called, and we can request data,
page-by-page by creating an implementation of GridDataSource interface.
Pages:
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188