# Justpy Tutorial demo grid_add_test 
# Adding HTML to Cells       
#      
# generated by write_as_demo  at 2022-11-15T07:26:24.036096+00:00 
# 
# see https://justpy.io/grids_tutorial/adding_html#adding-html-to-cells
import justpy as jp


grid_options = {
    'rowHeight': 200,
    'columnDefs': [
      {'headerName': "Make", 'field': "make"},
      {'headerName': "Model", 'field': "model"},
      {'headerName': "Price", 'field': "price"},
    ],
    'rowData': [
      {'make': "Toyota", 'model': "Celica", 'price': 4},
      {'make': "Ford", 'model': "Mondeo", 'price': '<div class="m-2 text-red-500 text-5xl">3</div>'},
      {'make': "Porsche", 'model': "Boxter", 'price': '<img src="https://www.python.org/static/community_logos/python-powered-h-140x182.png">'}
    ],
}

def grid_add_test():
    wp = jp.WebPage()
    grid = jp.AgGrid(a=wp, options=grid_options)
    grid.html_columns = [2]
    return wp

# initialize the demo
from examples.basedemo import Demo
Demo("grid_add_test", grid_add_test)
