PUGdoctype html
html(lang="fr")
head
script(src="/grist-plugin-api.js")
script(src="lib/brython.js")
script(src="lib/toastui-chart.min.js")
body(onload="brython(2)")
#content
if rec || recs
pre
code.content= JSON.stringify((rec || recs), null, 2)
else
.content Veuillez sélectionner une ligne.
script(type="text/python").
from browser import console, document, window
from browser.html import CODE, DIV, EM, PRE
grist, JSON = window.grist, window.JSON
content_div = document.select_one("#content")
content_div <= DIV(EM("VoilĂ ."))
def display(data):
content_div <= DIV(PRE(CODE(JSON.stringify(data))))
grist.docApi.fetchSelectedTable().then(display)
PYfrom browser import window
grist, render_pug = window.grist, window.render_pug
def onRecord(rec, *args):
render_pug({{"rec": rec}})
def onRecords(recs, *args):
render_pug({{"recs": recs}})
#grist.onRecord(onRecord)
#grist.onRecords(onRecords)
render_pug()