Skip to content

Commit

Permalink
use OrderedDicts for table rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
hhaensel committed Apr 18, 2024
1 parent 2b8b7d8 commit 9b3cc03
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Tables.jl
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ function columns(t::T)::Vector{<:Union{Column, Dict}} where {T<:DataTable}
end
end

function rows(t::T)::Vector{Dict{String,Any}} where {T<:DataTable}
rows = []
function rows(t::T)::Vector{OrderedDict{String,Any}} where {T<:DataTable}
rows = OrderedDict{String,Any}[]

for (count, row) in enumerate(TablesInterface.rows(t.data))
r = Dict()
r = OrderedDict{String, Any}()

if t.opts.addid
r[t.opts.idcolumn] = count
Expand All @@ -211,7 +211,7 @@ function rows(t::T)::Vector{Dict{String,Any}} where {T<:DataTable}
end

function data(t::T; datakey = "data", columnskey = "columns")::Dict{String,Any} where {T<:DataTable}
Dict(
OrderedDict(
columnskey => columns(t),
datakey => rows(t)
)
Expand Down

0 comments on commit 9b3cc03

Please sign in to comment.