Skip to content

Commit

Permalink
fix: exclude empty columns from CSV exports.
Browse files Browse the repository at this point in the history
  • Loading branch information
n1k0 committed Dec 2, 2024
1 parent 98302ee commit 140a35b
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/Page/Explore/Table.elm
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,19 @@ viewList routeToMsg defaultConfig tableState scope createTable items =

toCSV : Table data comparable msg -> List data -> Csv
toCSV { columns } items =
{ headers = List.map .label columns
let
nonEmptyColumns =
columns
|> List.filter (.label >> (/=) "")
in
{ headers =
nonEmptyColumns
|> List.map .label
, records =
items
|> List.map
(\item ->
columns
nonEmptyColumns
|> List.map (.toValue >> valueToString item)
)
}
Expand Down

0 comments on commit 140a35b

Please sign in to comment.