Open danielbachhuber opened 4 years ago
Could you please elaborate a bit more and provide an example?
Yea all PRs are welcome. Most likely you want to take a look at https://github.com/Kyslik/column-sortable/blob/L6/src/ColumnSortable/SortableLink.php#L21 function and do some shenanigans there.
Sorry for the late reply here.
Could you please elaborate a bit more and provide an example?
Sure. Here's my sortable table that has entries:
When there are no results on the table, I'd expect the table headings to render as, say, spans instead of links:
Most likely you want to take a look at https://github.com/Kyslik/column-sortable/blob/L6/src/ColumnSortable/SortableLink.php#L21 function and do some shenanigans there.
It looks like SortableLink
doesn't have any knowledge of the result set it's sorting, which I suppose makes sense.
The simplest approach would be to add a new parameter, and make it the responsibility of the caller to determine whether the SortableLink should render. I don't love this though. Can you think of a more elegant approach?
@if($collection->isNotEmpty()) @sortablelink() @else just text @endif
If the collection doesn't contain any entries, it would be nice if
sortableLink()
only displayed the title, and didn't render a link.Happy to submit a pull request if you can provide some direction. My code has a bunch of ugly conditionals right now.