Skip to content

Commit 3fe14bb

Browse files
authored
Update README.md
1 parent 909f203 commit 3fe14bb

File tree

1 file changed

+12
-5
lines changed
  • docs/reactive_components/700-collection

1 file changed

+12
-5
lines changed

docs/reactive_components/700-collection/README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class Shop::Pages::Products::Index < Matestack::Ui::Page
2525
def response
2626
async id: 'product-collection', rerender_on: "#{@collection_id}-udpate" do
2727
collection_content @collection.config do
28-
@collection.paginated_data.each do |product|
28+
@collection.data.each do |product|
2929
paragraph text: product.name
3030
end
3131
end
@@ -61,12 +61,14 @@ class Shop::Pages::Products::Index < Matestack::Ui::Page
6161
def response
6262
async id: 'product-collection', rerender_on: "#{@collection_id}-udpate" do
6363
collection_content @collection.config do
64+
# now we use paginated_data!
6465
@collection.paginated_data.each do |product|
6566
paragraph text: product.name
6667
end
6768
end
69+
# pagination has to be placed within the wrapping async!
70+
pagination
6871
end
69-
pagination
7072
end
7173

7274
def pagination
@@ -120,12 +122,15 @@ class Shop::Pages::Products::Index < Matestack::Ui::Page
120122
filter
121123
async id: 'product-collection', rerender_on: "#{@collection_id}-udpate" do
122124
collection_content @collection.config do
125+
# here we use paginated_data!
123126
@collection.paginated_data.each do |product|
124127
paragraph text: product.name
125128
end
126129
end
130+
# pagination has to be placed within the wrapping async!
131+
pagination
127132
end
128-
pagination
133+
129134
end
130135

131136
def filter
@@ -190,12 +195,14 @@ class Shop::Pages::Products::Index < Matestack::Ui::Page
190195
order
191196
async id: 'product-collection', rerender_on: "#{@collection_id}-udpate" do
192197
collection_content @collection.config do
198+
# here we use paginated_data!
193199
@collection.paginated_data.each do |product|
194200
paragraph text: product.name
195201
end
196202
end
203+
# pagination has to be placed within the wrapping async!
204+
pagination
197205
end
198-
pagination
199206
end
200207

201208
def order
@@ -217,4 +224,4 @@ end
217224

218225
## Complete documentation
219226

220-
If you want to know all details about the collection component as well as more example on how to use filtering, ordering and pagination together checkout its [api documentation](/docs/api/100-components/collection.md).
227+
If you want to know all details about the collection component as well as more example on how to use filtering, ordering and pagination together checkout its [api documentation](/docs/api/100-components/collection.md).

0 commit comments

Comments
 (0)