Skip to content

Commit 72203d4

Browse files
authored
Merge pull request #3 from daniapq/add-sorting-option
Add sorting option
2 parents e0f6551 + 5417756 commit 72203d4

21 files changed

+1310
-1001
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
"
2+
Description
3+
-----------
4+
5+
I am the principal component to create a paginated table with collections
6+
"
7+
Class {
8+
#name : #PSSortedTableCollectionComponent,
9+
#superclass : #PSSortedTableComponent,
10+
#category : #'PSTableSeaside-Components'
11+
}
12+
13+
{ #category : #adding }
14+
PSSortedTableCollectionComponent >> addObjectOfIndex: anIndex to: aList [
15+
"Add object of a given index to a given list"
16+
17+
aList add: (self rowAtIndex: anIndex)
18+
]
19+
20+
{ #category : #initialization }
21+
PSSortedTableCollectionComponent >> initialize [
22+
23+
super initialize.
24+
rows := OrderedCollection new.
25+
unsortedRows := OrderedCollection new.
26+
filteredRows := OrderedCollection new.
27+
]
28+
29+
{ #category : #initialization }
30+
PSSortedTableCollectionComponent >> initializeList [
31+
"Initialize list of object of current page"
32+
33+
^ OrderedCollection new
34+
]
35+
36+
{ #category : #'rendering-table' }
37+
PSSortedTableCollectionComponent >> render: html with: anObject [
38+
"Render object on html"
39+
40+
self subclassResponsibility
41+
]
42+
43+
{ #category : #rendering }
44+
PSSortedTableCollectionComponent >> renderRowsOfPageOn: html [
45+
"Render rows of a page on html"
46+
47+
(self rowsByPage)
48+
do: [ :object |
49+
html tableRow: [ self render: html with: object ] ]
50+
]
51+
52+
{ #category : #accessing }
53+
PSSortedTableCollectionComponent >> rowAtIndex: anIndex [
54+
"Return the row at given index"
55+
56+
^ self filteredRows at: anIndex
57+
]
58+
59+
{ #category : #sorting }
60+
PSSortedTableCollectionComponent >> sortCollectionwith: aSelector OnRowIndex: aRowIndex [
61+
62+
self filteredRows
63+
sort: [ :cell :anotherCell |
64+
[ (cell at: aRowIndex)
65+
perform: aSelector
66+
with: (anotherCell at: aRowIndex) ]
67+
on: MessageNotUnderstood
68+
do: [ true ] ]
69+
]
70+
71+
{ #category : #'rendering-searching' }
72+
PSSortedTableCollectionComponent >> validateFilterOf: anObject [
73+
74+
self subclassResponsibility
75+
]

0 commit comments

Comments
 (0)