I’ve been using Pagetable | Kirby CMS Plugins with a lot of v2 and v3 projects with ease. The new table layout is super nice but it’s lacking for example the option to click on a column to sort it. But the biggest issue yet with Kirby 5.0.3 for me, it is struggling to show results of 30 items. The snappy feeling of kirby is not there anymore.
Is there some features I’ve missed that would speed up a bit the process or is it a bug?
Here’s a video
and here’s the code:
works_all:
label: All (table)
icon: draft
columns:
- width: 1/1
sections:
drafts:
label: Works All
type: pages
batch: true
status: all
templates: work
limit: 30
layout: table
columns:
info: false
client: true
date:
type: text
value: '{{ page.date.toDate("Y") }}'
width: 3/24
# designers:
# type: tags
# width: 1/12
# work_field:
# label: Domaines
# type: tags
# categories:
# label: Categories
# value: '{{ page.category_print }} {{ page.category_identity }} {{ page.category_digital }} {{ page.category_signage }} {{ page.category_image }}'
# type: tags
homepage_visible:
label: Home
width: 2/16
homepage_link:
label: Link
width: 2/16
case_study_ready:
label: Case study
width: 2/16
Try adding this to your drafts section blueprint
rawvalues: true
and see if it helps. Although I think that will not render your toggles (you will see values TRUE/FALSE instead).
To see if it is just the table layout that causes the problem you can try changing the layout to list (or cards etc).
Hi, many thanks for the reply. I’ve tried it. The table is super fast but all the toggles are “ON” despite the fact that they are not. ;/ True / False would be more helpful though.
I’ve already created a layout with cards and it is almost instant. The table with rendered toggle seems to struggle. I’m wondering if it’s possible to improve that Kirby side?
I didn’t upgrade to 5 yet. In 4.7 at least I see true/false when using rawvalues. So something seems to have changed in 5 in this regard.
The table performance thing is a known issue (I was hoping it had been fixed in Kirby 5).
opened 07:03PM - 18 Apr 24 UTC
closed 05:08PM - 31 Jul 24 UTC
## Description
After updating to 4.2, some page sections with `layout: table` l… oad extremely slow. 100 pages ~10 seconds, 30 pages ~6 seconds. The issue goes away when changing layout to list, cardlets or cards. Confirmed by other users too.
In the forum it was suggested by @rasteiner that the toggle field preview fix in this commit https://github.com/getkirby/kirby/commit/75eb89cc27d35c0cd0da06680077462119bd2e88 can be the cause:
"It seems to introduce a new instantiation (new Form($model)) which is run for every row in the table."
## Your setup
**Kirby Version**
Kirby 4.2
**Additional context**
More details in the forum post https://forum.getkirby.com/t/page-sections-load-slow-kirby-4-2-issue/31373/3
opened 05:08PM - 31 Jul 24 UTC
## Problem description
In Kirby 4.2 and 4.3, the pages section currently can … be hit by a drastic performance issue when used with table layout and using computational heavy parts anywhere in the blueprint (e.g. accessing a large index in a query).
This is because our field and blueprint classes resolve everything very greedily, unfortunately. So setups that somewhere in the blueprint work with the site index or just any performance-heavy thing really get tolled as likely for every table row the blueprints are newly resolved etc.
## Current workaround
From Kirby 4.4. onwards, you can add `rawvalues: true` to your section in the blueprint. What does it do:
It reverts the behavior to pre-4.2, which is passing raw values from the content file to the table preview components. This can cause other problems with the field previews, e.g. the toggle field would receive a string not a bool. Some previews won't work then in your setup.
Overall, we know this isn't a great solution. It's more a trade-off for developers as many setups might be fine with one of the two versions: Some are not faced with the performance issue and are happy with correctly passed values, others might be able to work around the broken field previews as long as the pages section doesn't completely slow down the Panel for them.
## Additional context
Code that causes the performance issue: https://github.com/getkirby/kirby/blob/main/config/sections/mixins/layout.php#L136-L150
Just a thought… If you define the toggle column as type:text in your table setup, does that show correct true/false values?
# ...
layout: table
rawvalues: true
columns:
case_study_ready:
type: text
# Optionally customize the text?
# value: "{{ page.case_study_ready.isTrue ? 'Yepp' : 'Nope' }}"
# ...
Yes, it works. many thanks for the tip. Well, at least, I know the table layout needs some fixes. I’ve moved directly from 3.x to 5.x.