package outwatchapp.components import scala.annotation.unused import scala.scalajs.js.annotation.JSExportAll import scala.scalajs.js.annotation.JSImport import colibri.ext.monix._ import monix.bio.Task import monix.eval.Coeval import monix.execution.Cancelable import org.scalajs.dom.raw.HTMLElement import outwatch.ManagedSubscriptions.managedElement import typings.datatablesNet.DataTables.ColumnSettings import typings.datatablesNet.DataTables.FunctionColumnRender import typings.datatablesNet.DataTables.Settings import typings.datatablesNet.datatablesNetRequire import typings.jquery.JQuery_ import typings.jquery.{mod => $} import scalajs.js @js.native @JSImport( "datatables.net-bs4/css/dataTables.bootstrap4.min.css", JSImport.Namespace ) object DataTablesBs4Css extends js.Object @js.native @JSImport( "datatables.net-bs4/js/dataTables.bootstrap4.min.js", JSImport.Namespace ) object DataTablesBs4Js extends js.Object object DatatablesDemo { implicit def isJQueryDT[T](x: JQuery_[T]): typings.datatablesNet.JQuery = x.asInstanceOf[typings.datatablesNet.JQuery] datatablesNetRequire DataTablesBs4Css DataTablesBs4Js @unused private def _test(tableElement: HTMLElement) = $(tableElement) .DataTable( Settings().setColumnsVarargs( ColumnSettings().setData("name").setRender(nameRenderFn) ) ) .destroy() val nameRenderFn: FunctionColumnRender = (_data, tpe, row, d) => { if (tpe.toString == "display") println("Matched") else println("Did not match") // this can be done with scalatags instead s"""