rewirk tablecolum js a bit when more than once tablelisting is on one page; do not allow empty column selection

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-10-16 17:10:57 +02:00
parent 1704875cea
commit 71274f8f08
4 changed files with 26 additions and 24 deletions

View File

@@ -219,11 +219,14 @@ class Ajax
private function updateTablelisting()
{
$columns = [];
foreach (Request::get('columns') as $value) {
foreach ((Request::get('columns') ?? []) as $value) {
$columns[] = $value;
}
Listing::storeColumnListingForUser([Request::get('listing') => $columns]);
return $this->jsonResponse($columns);
if (!empty($columns)) {
Listing::storeColumnListingForUser([Request::get('listing') => $columns]);
return $this->jsonResponse($columns);
}
return $this->errorResponse('At least one column must be selected', 406);
}
private function resetTablelisting()