Selectable rows table example
On this page
Source
Selectable rows
Name | Capital | Region | Area | |
---|---|---|---|---|
Aruba | Oranjestad | Americas | 180.0 | |
Afghanistan | Kabul | Asia | 652230.0 | |
Angola | Luanda | Africa | 1246700.0 | |
Anguilla | The Valley | Americas | 91.0 | |
Åland Islands | Mariehamn | Europe | 1580.0 | |
Albania | Tirana | Europe | 28748.0 | |
Andorra | Andorra la Vella | Europe | 468.0 | |
United Arab Emirates | Abu Dhabi | Asia | 83600.0 | |
Argentina | Buenos Aires | Americas | 2780400.0 | |
Armenia | Yerevan | Asia | 29743.0 |
val table = new Table5Base
with Table5BaseBootrapSupport
with Table5SelectableRows
with Table5StandardColumns
with Table5Paginated {
override type R = Country
override def defaultPageSize: Int = 10
val ColName = ColStr("Name", _.name.common)
val ColCapital = ColStr("Capital", _.capital.mkString(", "))
val ColRegion = ColStr("Region", _.region)
val ColArea = ColStr("Area", _.area.toString)
override def columns(): List[C] = List(
ColName
, ColCapital
, ColRegion
, ColArea
, ColSelectRow
)
override def seqRowsSource: Seq[Country] = CountriesData.data
}
new Widget {
override def widgetTitle: String = "Selectable rows"
override def transformWidgetCardBody(elem: Elem): Elem = super.transformWidgetCardBody(elem).p_0
override def widgetTopRight()(implicit fsc: FSContext): NodeSeq = table.clearRowSelectionBtn.btn ++ table.selectAllVisibleRowsBtn.btn.ms_2
override def widgetContents()(implicit fsc: FSContext): NodeSeq = table.render()
}.renderWidget()