Sorted Columns
enextiarg opened this issue · 7 comments
enextiarg commented
Summary of problem or feature request
Needed sorted columns
Code snippet of problem
private function compileTableHeaders()
{
$th = [];
foreach ($this->collection->toArray() as $row) {
$thAttr = $this->html->attributes(array_merge(
array_only($row, ['class', 'id', 'width', 'style', 'data-class', 'data-hide']),
$row['attributes']
));
$th[] = '<th ' . $thAttr . '>' . $row['title'] . '</th>';
}
return $th;
}
System details
We could add a sortBy in the foreach in line 587 of Builder file
private function compileTableHeaders()
{
$th = [];
foreach ($this->collection->sortBy('order')->toArray() as $row) {
$thAttr = $this->html->attributes(array_merge(
array_only($row, ['class', 'id', 'width', 'style', 'data-class', 'data-hide']),
$row['attributes']
));
$th[] = '<th ' . $thAttr . '>' . $row['title'] . '</th>';
}
return $th;
}
yajra commented
Sorry for late reply. Please do not hesitate to submit a PR if you still need. Thanks!
enextiarg commented
Hi, it's only a proposal, it could be interesting sort columns before render.
yajra commented
Sort before render, I think you just need orders
option?
->orders([[1, 'desc'], [2, 'asc']])
->orderBy(3, 'desc')
For column arrangement, just set it in the getColumns()
method?
github-actions commented
This issue is stale because it has been open for 30 days with no activity.
enextiarg commented
It's a proposal about columns order, not rows or data.
github-actions commented
This issue is stale because it has been open for 30 days with no activity.
github-actions commented
This issue was closed because it has been inactive for 7 days since being marked as stale.