F
Filamentβ€’8mo ago
Oddman

Is the Split component for tables busted?

I cannot seem to get this to work following the documentation. In fact, it completely breaks my table presentation (no errors). Furthermore, the from() method doesn't appear to be having any effect...
Solution:
Sorry maybe I copy/pasted something wrong, but try to wrap the entire columns definition in a Split
Jump to solution
9 Replies
Oddman
Oddmanβ€’8mo ago
Ah think I figured it out, looks like the split has to go around the entire column definition? Yeah, not sure - I just want 2 columns to stack on mobile, and can't figure it out. If I put a split, it seems to ruin the entire row:
->columns([
TextColumn::make('id')->sortable(),
CuratorColumn::make('heroImage')->size(40),
Tables\Columns\Layout\Split::make([
TextColumn::make('title')->searchable(),
TextColumn::make('category.title')->color('gray'),
])->from('md'),
self::iconColumn('early_access'),
self::iconColumn('pro_series'),
->columns([
TextColumn::make('id')->sortable(),
CuratorColumn::make('heroImage')->size(40),
Tables\Columns\Layout\Split::make([
TextColumn::make('title')->searchable(),
TextColumn::make('category.title')->color('gray'),
])->from('md'),
self::iconColumn('early_access'),
self::iconColumn('pro_series'),
Yeah, I don't get it. Hours gone - I don't understand the how or why of stack/split. Any combo I come up with completely breaks the table. I was assuming that stack/split can be used like normal columns with a child schema, but that doesn't appear to be the case. No idea.
Arnold Schwarzenegger
Arnold Schwarzeneggerβ€’8mo ago
Try this
->columns(
Tables\Columns\Layout\Split::make([
TextColumn::make('id')->sortable(),
CuratorColumn::make('heroImage')->size(40),
Tables\Columns\Layout\Split::make([
TextColumn::make('title')->searchable(),
TextColumn::make('category.title')->color('gray'),
])->from('md'),
self::iconColumn('early_access'),
self::iconColumn('pro_series'),
])
)
->columns(
Tables\Columns\Layout\Split::make([
TextColumn::make('id')->sortable(),
CuratorColumn::make('heroImage')->size(40),
Tables\Columns\Layout\Split::make([
TextColumn::make('title')->searchable(),
TextColumn::make('category.title')->color('gray'),
])->from('md'),
self::iconColumn('early_access'),
self::iconColumn('pro_series'),
])
)
Oddman
Oddmanβ€’8mo ago
Sorry what am I meant to be doing here? Syntax seems wrong. Are there nested splits?
Solution
Arnold Schwarzenegger
Arnold Schwarzeneggerβ€’8mo ago
Sorry maybe I copy/pasted something wrong, but try to wrap the entire columns definition in a Split
Oddman
Oddmanβ€’8mo ago
Cheers @Arnold Schwarzenegger - unfortunately it's not stacking on mobile, as per the docs.
Arnold Schwarzenegger
Arnold Schwarzeneggerβ€’8mo ago
hmm maybe a `from('md') on the entire split? This is how I use it and it seams to work
columns([
Split::make([ ... ])
->from('md')
])
columns([
Split::make([ ... ])
->from('md')
])
Oddman
Oddmanβ€’8mo ago
Ohhhh... Okay, I think I understand how it's meant to be used now. The layout's fubar on mobile though πŸ€”
Arnold Schwarzenegger
Arnold Schwarzeneggerβ€’8mo ago
You can have nested splits, keep things in one row if you want If you have a Split::make without a from I think it will keep it in one row
Oddman
Oddmanβ€’8mo ago
Yeah, seems that way. So looks like I'll need multiple splits to lay it out how I want πŸ™‚ thanks, @Arnold Schwarzenegger . Very helpful!