from epyk.core.Page import Report
from epyk.tests import test_statics

rptObj = Report()

data = [{"A": 1, "B": 2}]
rptObj.ui.tables.tabulators.table(data, cols=["A"], rows=["B"])

datatable = rptObj.ui.tables.datatables.table(data, cols=["A"], rows=["B"])

# print( rptObj.ui.tables.basic([], [], []).tableId )
datatable.dom.addOnReady([
  datatable.js.clear(update=True),
  datatable.js.rows.add(
    [
      {"A": "A", "B": 5454},
      {"A": "B", "C": 5454},
    ], toArray=True).draw().remove(),
  datatable.js.row.child().hide(),
  datatable.js.container_dom().addClass("test", {"border": "1px solid pink", "color": "pink"})
  #datatable.js.container_dom().css({"border": "1px solid green"})
])

rptObj.js.addOnReady(
  [
    rptObj.js.window.alert(datatable.js.rows.data())
  ]
)

rptObj.outs.browser.codepen(path=test_statics.OUTPUT_PATHS,
                            open_browser=True)