Open gbdesign2023 opened 8 months ago
@gbdesign2023 This is more like a missing feature. The headers toggle was more of an experimental for your issue and was added only to the field itself (that's why it works on the drawer and not the preview), also the headers would still appear on your page even if headers: false
(for blocks).
I'd say right now it's more of an experimental feature as I could not find a nice way to integrate this and I'm not satisfied with it. Here's my current approach:
We're talking about rendering of the table inside the page, my idea was to alter the toTable
method as follows:
// get the field blueprint
$blueprint = $field->parent()->blueprint()->field($field->key());
// return the headers field value
$hasHeaders = $blueprint['headers'] ?? true;
// return the first row if true or an empty array if false
$headers = $hasHeaders ? array_shift($rows) : [];
This translates into the following:
headers: true
(default) headers consider the first row as headersheaders: false
headers return empty and the first row returns to the rows arrayAnd the current problems are:
At this point, I don't know exactly what would even be the best approach to this feature or if I'm looking at it the right way. Some thoughts regarding this matter would be appreciated.
Perhaps I have created an unnecessary complication... My problem was the missing "thead" in the previous plug-in. I had created a temporary solution for this in the template. Today I have removed this temporary solution and can use "thead" as in your template. If I don't need a "thead", I can solve this individually, for example with a toggle field in the table options. I assume that 99% of other users need a "thead" for tables. Instead of adding new functions, it would be better to concentrate on the core functions of a table.
This feature is still welcomed but would stay as 'experimental' for now until I can find a good balance on how it works.
@gbdesign2023 Would be nice to share your progress on how you've been able to fix your issue after the last update and some panel shots/video on how are you currently using it. It would help me to better understand it's purpose. :)
I have found a small, cosmetic problem: With the setting "headers: false" in the blueprint, the first line is still displayed as a header in the inline editor. In the dialog editor, the display is correct.