Paginated Table Example

Source Code

  override def renderExampleContents()(implicit fsc: FSContext): NodeSeq = {
    new Table5Base
      with Table5BaseBootrapSupport
      with Table5StandardColumns
      with Table5SeqSortableDataSource
      with Table5Paginated {

      override type R = Country



      override def defaultPageSize = 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
      )


      override def rowsSorter: PartialFunction[Table5StandardColumn[Country], Seq[Country] => Seq[Country]] = {
        case ColName => _.sortBy(_.name.common)
      }

      override def seqRowsSource: Seq[Country] = CountriesData.data
    }.render()
  }
NameCapitalRegionArea
ArubaOranjestadAmericas180.0
AfghanistanKabulAsia652230.0
AngolaLuandaAfrica1246700.0
AnguillaThe ValleyAmericas91.0
Åland IslandsMariehamnEurope1580.0
AlbaniaTiranaEurope28748.0
AndorraAndorra la VellaEurope468.0
United Arab EmiratesAbu DhabiAsia83600.0
ArgentinaBuenos AiresAmericas2780400.0
ArmeniaYerevanAsia29743.0