Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,20 @@ authors = ["Benjamin Lungwitz <benj.lung@googlemail.com> and contributors"]
version = "0.1.2"

[deps]
CSV = "336ed68f-0bac-5ca0-87d4-7b16caf5d00b"
DataFrames = "a93c6f00-e57d-5684-b7b6-d8193f3e46c0"
HypertextLiteral = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2"
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
Tables = "bd369af6-aec1-5ad0-b16a-f7cc5008161c"
URIs = "5c2747f8-b7ea-4ff2-ba2e-563bfd36b1d4"

[compat]
CSV = "0.10.15"
DataFrames = "1"
HypertextLiteral = "0.9"
JSON = "0.21.4"
Tables = "1"
URIs = "1.5.1"
julia = "1"

[extras]
Expand Down
9 changes: 9 additions & 0 deletions src/PlutoGrid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ using HypertextLiteral: @htl, JavaScript
using Tables
using DataFrames

##Custom packages required for the pluto notebook
using CSV, JSON, URIs

export readonly_table, editable_table, create_dataframe

const MODIFIED_COL_INDICATOR = "modified_column_"
Expand Down Expand Up @@ -176,6 +179,7 @@ function numberParser(params) {
return Number(params.newValue);
};


var div = currentScript.parentElement;
// set default output value
div.value = null;
Expand Down Expand Up @@ -257,6 +261,11 @@ function _make_col_defs(df; filterable=true, editable_cols=String[])
col_dict["type"] = "numericColumn"
filterable && (col_dict["filter"] = "agNumberColumnFilter")
col_is_editable && (col_dict["valueParser"] = JavaScript("numberParser"))

elseif eltype(df[!, c]) <: URI
col_dict["cellRenderer"] = JavaScript(raw"""params => {
return `<img src="${params.value}" style="width: 50px; height: 50px; object-fit: cover;" />`;
}""")
end
# ToDo: add type / filter for dates

Expand Down