Easiest way to build a header for a table

Hi guys,

How would I build a header for a repeating group? Should I create a table and put a repeating group in it or am I complicating things?

I’ve got a repeating group at the moment on a column layout. I tried inserting a group inside each cell of the repeating group, but it adds it as a new column not a row at the top

and here’s the element tree structure

The header needs to be outside of the repeating group.

Well, the way I set mine up was to put the header right inside the cell.

So, for your group ‘date booked’ you would put the header right in that cell at the top…

then, put a condition on the header:

I did it this way because it’s easy to keep the header aligned the way you want it. Here is a demo of how mine looks. The header only shows on the first cell:

1 Like

That’s a good alternative…

But then it’s more difficult to make the header ‘sticky’ so it doesn’t scroll with the table content… (although it’s still possible).

2 Likes

True, you could still make it sticky.

I think I was typing my comment when you typed your original comment :grinning_face:

I also see from my demo that I need to add some padding on the header names after the merchant type, because of my dropdown’s height

1 Like

Thanks BUT i need a cell on top of each column so each has its own title header. How would I Do that?

Let the header not be part of the repeating group and use max and min width for each cell

1 Like

Mine has a header at the top of each column.

Maybe I’m misunderstanding what you are looking for?

Added: If for your use case, having the header outside like was mentioned above is better for you, then follow that advice. For my use case, this is how I have mine set up

1 Like

Oh I see. I missunderstood, sorry! :slight_smile: so you’re headers are Merchant Type, Compamny name and so on right? I need it inside the repeating group because i want to have the same style. What’s your header? Just text?

1 Like

Yes, it’s just text.

You can design the text however you want… add padding, etc.

If you want every other row to be colored like my example, I use modulo on the row. Although in my demo I should have added some padding and rounded corners to the rows so the coloring would be more uniform with the rg layout:

It can be outside the RG as @adamhholmes proposed and still have the same style.

1 Like

Yes, you can put it outside…

but, outside you can only make it dynamic at the list level.

Inside you can make it dynamic at the row level.

This is why I was saying inside works best for me.

The demo I showed doesn’t use dynamic at the row level, but I have some repeating groups that do, so I just use this method. Plus, it’s simple and always aligns right

1 Like

Hey @senecadatabase . I managed to do something, but what I want to do ideally is have one uniffied grey header with name for each column. AS you can see, because I have spacers betweeen columns there is white space between the grey hedaers (i coloured the groups of heading text)

How would I do that? thanks a lot!

Yes.

At the top of each column in your cell, just add a header text and design it the way you want.

Then, put the condition I mentioned.

Each header will only show on the cell if it is cell 1

1 Like

Can you help me understand when a column header would actually need to be dynamic based on a specific row’s content?

Even if you’re faking a header as the first row inside the RG, the header is effectively based on the first item in the list, not on each row independently. In that case you could still drive the header dynamically from “RG:first item” without needing the header to live inside the repeating rows themselves.

If the header is derived from the dataset as a whole, it can live outside and be driven by the first item. If the header needs to react to row boundaries or grouping changes, it has to live inside the repeating context.

I guess you mean group and section headers and not column headers?

Yes.

Let’s take my use case.

If I’m sorting an RG by categories…pizza shops, hair salons, auto shops, etc., an outside header can’t do that.

So, in my case, I want the header to change based on the category.

The only way to do that is to have the header in the RG.

Added: You could also have a header outside the repeating group that had the company name, etc. But to me that is redundant…especially when the first item would have ‘pizza shops’ etc.

I guess it all comes down to design preferences

Makes sense. I think we’re talking about two different things.

Section/group headers (Pizza Shops, Hair Salons, etc.) would need to live inside the RG since they depend on category groupings.

For column headers (Merchant Type, Company Name, etc.), I usually keep them outside the RG, mainly because 1) If the RG is empty, you often still want the column headers visible and 2) It’s easier to maintain (When the header is faked as the first RG row, people can miss it or accidentally edit it thinking it’s real data) and 3) stickyness is much easier.

2 Likes

Yes.

I had edited my reply to say if you want an outside header with generic info, that was a design choice.

To me, it’s redundant when the first item starts off with ‘pizza shops’ etc.

I don’t have empty groups because they don’t show if the category is empty.

Thanks for the questions though. I think we’re both on the same page, maybe just have different design ideas :grinning_face:

Added: My headers are sticky until the last item in that category