Closed kipcole9 closed 5 months ago
:+1:. @cristineguadelupe @jonatanklosko, do you foresee any issues?
I have made the necessary changes in a fork of kino and implemented a livebook demonstrating an example using a formatter I built into a new release of ex_cldr.
If you find the overall outcome acceptable I'll submit a PR. I'm unsure how to create tests for this change and I couldn't see any for the current implementation so I hope the example livebook is acceptable.
I dropped some nits, it looks great to me :)
Closing in favor of PR.
Currently
Kino.DataTable
formats data with either theString.Chars
implementation orinspect/2
. However the default presentation isn't localizable or customisable - and since Livebooks can be targeted at a wider audience than just Elixir developers, an option to provide a formatter function would seem a good improvement to user experience.The simplest option would be to add an optional formatter function to
Kino.DataTable.new/2
. For example:The formatter function would receive the column value and the key so that formatting can be contextual. The default would be the current
value_to_string/1
function, slightly modified to accept (and ignore) the key.If this idea is accepted I am very willing to create a PR. And of course if there is a better API thats good too.