Questions about the possibilities of <k-table>

Hello,

I’m tinkering on a plugin and since I’m stuck at moving forward right now. I managed to show a separate page for my plugin with a table to format data. The data comes from a DB and is shown correctly. However I would like to provide some html arround that data like making some parts bold or wrapping them in a link. I guess, this should happen in the components .vue file at ther export part, which looks like this right now:

<script>
export default {
  props: {
    orders: Array
  }
}
</script>

The orders property comes from the views PHP file. I’m cycling there through the database output and adding some tags and stuff, but it is escaped. So I guess, this step might need to be done in the .vue file itself, but I’m lost in how to do so.

The other question is, if I can get the k-table-columns more flexible easily. Right now, there is only the possibility to make the width auto or a fixed width such as 1/12 or 1/6. What I prefer though would be that the width of some columns is changing by the minimal size that is needed to fit in it’s data.

Would appreciate to get some help here!

Thanks in advance,

Jonas

Hm, for all I know, you can set the column type to html to render safe HTML

Hey @texnixe!

Thanks so far for your answer. Hm, neither in Column | Kirby CMS nor in kirby/Column.vue at 3.9.2 · getkirby/kirby · GitHub a column type property is present. Also, I’m using k-table, not grid and I’m transfering the columns and field arrays right into the Table component and by default I have no access to the column types that way.

Okay, I was able to set the rendering to html by the following code:

      order: {
        label: 'Orders',
        mobile: true,
        width: '1/4',
        type: 'html'
      },

It is not mentioned in the documentation unfortunally and the first time I tried, it didn’t work (Which of course means I did something wrong, because now it works). The other problem I kinda worked around by using css white-space: break-spaces;, however it is not the same as making the columns flexible in width by content.

Yes, that unfortunate, I took it from here: Pages section | Kirby CMS, but it’s not documented on the Panel part of things.

1 Like

Thanks @texnixe!
So on the topic of flexible width columns you have no ideas or easy fixes for me? As said in my first comment, it seems to me that I can only set the width as String like “1/2”, but maybe you know something more than me here as well…

Not quite sure what you would have to set for width to achieve what you want, probably rather some min width instead of width?

No, I think it won’t help. But it’s okay - Of course I can overwrite all default kirby css stuff and make it display:flex and should achive that. I just thought I’m not the first one who needs flexible column widths and it may be build into the core and I just don’t find it. :slight_smile: