Sortable Table Example
Source Code
override def renderExampleContents()(implicit fsc: FSContext): NodeSeq = {
new Table5Base
with Table5BaseBootrapSupport
with Table5StandardColumns
with Table5SeqSortableDataSource
with Table5Sortable {
override type R = Country
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)
case ColCapital => _.sortBy(_.capital.mkString(", "))
case ColRegion => _.sortBy(_.region)
case ColArea => _.sortBy(_.area)
}
override def seqRowsSource: Seq[Country] = CountriesData.data
}.render()
}
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 |
American Samoa | Pago Pago | Oceania | 199.0 |
Antarctica | Antarctic | 1.4E7 | |
French Southern and Antarctic Lands | Port-aux-Français | Antarctic | 7747.0 |
Antigua and Barbuda | Saint John's | Americas | 442.0 |
Australia | Canberra | Oceania | 7692024.0 |
Austria | Vienna | Europe | 83871.0 |
Azerbaijan | Baku | Asia | 86600.0 |
Burundi | Gitega | Africa | 27834.0 |
Belgium | Brussels | Europe | 30528.0 |
Benin | Porto-Novo | Africa | 112622.0 |
Burkina Faso | Ouagadougou | Africa | 272967.0 |
Bangladesh | Dhaka | Asia | 147570.0 |
Bulgaria | Sofia | Europe | 110879.0 |
Bahrain | Manama | Asia | 765.0 |
Bahamas | Nassau | Americas | 13943.0 |
Bosnia and Herzegovina | Sarajevo | Europe | 51209.0 |
Saint Barthélemy | Gustavia | Americas | 21.0 |
Saint Helena, Ascension and Tristan da Cunha | Jamestown | Africa | 394.0 |
Belarus | Minsk | Europe | 207600.0 |
Belize | Belmopan | Americas | 22966.0 |
Bermuda | Hamilton | Americas | 54.0 |
Bolivia | Sucre | Americas | 1098581.0 |
Caribbean Netherlands | Americas | 328.0 | |
Brazil | Brasília | Americas | 8515767.0 |
Barbados | Bridgetown | Americas | 430.0 |
Brunei | Bandar Seri Begawan | Asia | 5765.0 |
Bhutan | Thimphu | Asia | 38394.0 |
Bouvet Island | Antarctic | 49.0 | |
Botswana | Gaborone | Africa | 582000.0 |
Central African Republic | Bangui | Africa | 622984.0 |
Canada | Ottawa | Americas | 9984670.0 |
Cocos (Keeling) Islands | West Island | Oceania | 14.0 |
Switzerland | Bern | Europe | 41284.0 |
Chile | Santiago | Americas | 756102.0 |
China | Beijing | Asia | 9706961.0 |
Ivory Coast | Yamoussoukro | Africa | 322463.0 |
Cameroon | Yaoundé | Africa | 475442.0 |
DR Congo | Kinshasa | Africa | 2344858.0 |
Republic of the Congo | Brazzaville | Africa | 342000.0 |
Cook Islands | Avarua | Oceania | 236.0 |
Colombia | Bogotá | Americas | 1141748.0 |
Comoros | Moroni | Africa | 1862.0 |
Cape Verde | Praia | Africa | 4033.0 |
Costa Rica | San José | Americas | 51100.0 |
Cuba | Havana | Americas | 109884.0 |
Curaçao | Willemstad | Americas | 444.0 |
Christmas Island | Flying Fish Cove | Oceania | 135.0 |
Cayman Islands | George Town | Americas | 264.0 |
Cyprus | Nicosia | Europe | 9251.0 |
Czechia | Prague | Europe | 78865.0 |
Germany | Berlin | Europe | 357114.0 |
Djibouti | Djibouti | Africa | 23200.0 |
Dominica | Roseau | Americas | 751.0 |
Denmark | Copenhagen | Europe | 43094.0 |
Dominican Republic | Santo Domingo | Americas | 48671.0 |
Algeria | Algiers | Africa | 2381741.0 |
Ecuador | Quito | Americas | 276841.0 |
Egypt | Cairo | Africa | 1002450.0 |
Eritrea | Asmara | Africa | 117600.0 |
Western Sahara | El Aaiún | Africa | 266000.0 |
Spain | Madrid | Europe | 505992.0 |
Estonia | Tallinn | Europe | 45227.0 |
Ethiopia | Addis Ababa | Africa | 1104300.0 |
Finland | Helsinki | Europe | 338424.0 |
Fiji | Suva | Oceania | 18272.0 |
Falkland Islands | Stanley | Americas | 12173.0 |
France | Paris | Europe | 551695.0 |
Faroe Islands | Tórshavn | Europe | 1393.0 |
Micronesia | Palikir | Oceania | 702.0 |
Gabon | Libreville | Africa | 267668.0 |
United Kingdom | London | Europe | 242900.0 |
Georgia | Tbilisi | Asia | 69700.0 |
Guernsey | St. Peter Port | Europe | 78.0 |
Ghana | Accra | Africa | 238533.0 |
Gibraltar | Gibraltar | Europe | 6.0 |
Guinea | Conakry | Africa | 245857.0 |
Guadeloupe | Basse-Terre | Americas | 1628.0 |
Gambia | Banjul | Africa | 10689.0 |
Guinea-Bissau | Bissau | Africa | 36125.0 |
Equatorial Guinea | Malabo | Africa | 28051.0 |
Greece | Athens | Europe | 131990.0 |
Grenada | St. George's | Americas | 344.0 |
Greenland | Nuuk | Americas | 2166086.0 |
Guatemala | Guatemala City | Americas | 108889.0 |
French Guiana | Cayenne | Americas | 83534.0 |
Guam | Hagåtña | Oceania | 549.0 |
Guyana | Georgetown | Americas | 214969.0 |
Hong Kong | City of Victoria | Asia | 1104.0 |
Heard Island and McDonald Islands | Antarctic | 412.0 | |
Honduras | Tegucigalpa | Americas | 112492.0 |
Croatia | Zagreb | Europe | 56594.0 |
Haiti | Port-au-Prince | Americas | 27750.0 |
Hungary | Budapest | Europe | 93028.0 |
Indonesia | Jakarta | Asia | 1904569.0 |
Isle of Man | Douglas | Europe | 572.0 |
India | New Delhi | Asia | 3287590.0 |
British Indian Ocean Territory | Diego Garcia | Africa | 60.0 |
Ireland | Dublin | Europe | 70273.0 |
Iran | Tehran | Asia | 1648195.0 |
Iraq | Baghdad | Asia | 438317.0 |
Iceland | Reykjavik | Europe | 103000.0 |
Israel | Jerusalem | Asia | 20770.0 |
Italy | Rome | Europe | 301336.0 |
Jamaica | Kingston | Americas | 10991.0 |
Jersey | Saint Helier | Europe | 116.0 |
Jordan | Amman | Asia | 89342.0 |
Japan | Tokyo | Asia | 377930.0 |
Kazakhstan | Nur-Sultan | Asia | 2724900.0 |
Kenya | Nairobi | Africa | 580367.0 |
Kyrgyzstan | Bishkek | Asia | 199951.0 |
Cambodia | Phnom Penh | Asia | 181035.0 |
Kiribati | South Tarawa | Oceania | 811.0 |
Saint Kitts and Nevis | Basseterre | Americas | 261.0 |
South Korea | Seoul | Asia | 100210.0 |
Kosovo | Pristina | Europe | 10908.0 |
Kuwait | Kuwait City | Asia | 17818.0 |
Laos | Vientiane | Asia | 236800.0 |
Lebanon | Beirut | Asia | 10452.0 |
Liberia | Monrovia | Africa | 111369.0 |
Libya | Tripoli | Africa | 1759540.0 |
Saint Lucia | Castries | Americas | 616.0 |
Liechtenstein | Vaduz | Europe | 160.0 |
Sri Lanka | Colombo | Asia | 65610.0 |
Lesotho | Maseru | Africa | 30355.0 |
Lithuania | Vilnius | Europe | 65300.0 |
Luxembourg | Luxembourg | Europe | 2586.0 |
Latvia | Riga | Europe | 64559.0 |
Macau | Asia | 30.0 | |
Saint Martin | Marigot | Americas | 53.0 |
Morocco | Rabat | Africa | 446550.0 |
Monaco | Monaco | Europe | 2.02 |
Moldova | Chișinău | Europe | 33846.0 |
Madagascar | Antananarivo | Africa | 587041.0 |
Maldives | Malé | Asia | 300.0 |
Mexico | Mexico City | Americas | 1964375.0 |
Marshall Islands | Majuro | Oceania | 181.0 |
North Macedonia | Skopje | Europe | 25713.0 |
Mali | Bamako | Africa | 1240192.0 |
Malta | Valletta | Europe | 316.0 |
Myanmar | Naypyidaw | Asia | 676578.0 |
Montenegro | Podgorica | Europe | 13812.0 |
Mongolia | Ulan Bator | Asia | 1564110.0 |
Northern Mariana Islands | Saipan | Oceania | 464.0 |
Mozambique | Maputo | Africa | 801590.0 |
Mauritania | Nouakchott | Africa | 1030700.0 |
Montserrat | Plymouth | Americas | 102.0 |
Martinique | Fort-de-France | Americas | 1128.0 |
Mauritius | Port Louis | Africa | 2040.0 |
Malawi | Lilongwe | Africa | 118484.0 |
Malaysia | Kuala Lumpur | Asia | 330803.0 |
Mayotte | Mamoudzou | Africa | 374.0 |
Namibia | Windhoek | Africa | 825615.0 |
New Caledonia | Nouméa | Oceania | 18575.0 |
Niger | Niamey | Africa | 1267000.0 |
Norfolk Island | Kingston | Oceania | 36.0 |
Nigeria | Abuja | Africa | 923768.0 |
Nicaragua | Managua | Americas | 130373.0 |
Niue | Alofi | Oceania | 260.0 |
Netherlands | Amsterdam | Europe | 41850.0 |
Norway | Oslo | Europe | 323802.0 |
Nepal | Kathmandu | Asia | 147181.0 |
Nauru | Yaren | Oceania | 21.0 |
New Zealand | Wellington | Oceania | 270467.0 |
Oman | Muscat | Asia | 309500.0 |
Pakistan | Islamabad | Asia | 881912.0 |
Panama | Panama City | Americas | 75417.0 |
Pitcairn Islands | Adamstown | Oceania | 47.0 |
Peru | Lima | Americas | 1285216.0 |
Philippines | Manila | Asia | 342353.0 |
Palau | Ngerulmud | Oceania | 459.0 |
Papua New Guinea | Port Moresby | Oceania | 462840.0 |
Poland | Warsaw | Europe | 312679.0 |
Puerto Rico | San Juan | Americas | 8870.0 |
North Korea | Pyongyang | Asia | 120538.0 |
Portugal | Lisbon | Europe | 92090.0 |
Paraguay | Asunción | Americas | 406752.0 |
Palestine | Ramallah | Asia | 6220.0 |
French Polynesia | Papeetē | Oceania | 4167.0 |
Qatar | Doha | Asia | 11586.0 |
Réunion | Saint-Denis | Africa | 2511.0 |
Romania | Bucharest | Europe | 238391.0 |
Russia | Moscow | Europe | 1.7098242E7 |
Rwanda | Kigali | Africa | 26338.0 |
Saudi Arabia | Riyadh | Asia | 2149690.0 |
Sudan | Khartoum | Africa | 1886068.0 |
Senegal | Dakar | Africa | 196722.0 |
Singapore | Singapore | Asia | 710.0 |
South Georgia | King Edward Point | Antarctic | 3903.0 |
Svalbard and Jan Mayen | Longyearbyen | Europe | -1.0 |
Solomon Islands | Honiara | Oceania | 28896.0 |
Sierra Leone | Freetown | Africa | 71740.0 |
El Salvador | San Salvador | Americas | 21041.0 |
San Marino | City of San Marino | Europe | 61.0 |
Somalia | Mogadishu | Africa | 637657.0 |
Saint Pierre and Miquelon | Saint-Pierre | Americas | 242.0 |
Serbia | Belgrade | Europe | 88361.0 |
South Sudan | Juba | Africa | 619745.0 |
São Tomé and Príncipe | São Tomé | Africa | 964.0 |
Suriname | Paramaribo | Americas | 163820.0 |
Slovakia | Bratislava | Europe | 49037.0 |
Slovenia | Ljubljana | Europe | 20273.0 |
Sweden | Stockholm | Europe | 450295.0 |
Eswatini | Lobamba | Africa | 17364.0 |
Sint Maarten | Philipsburg | Americas | 34.0 |
Seychelles | Victoria | Africa | 452.0 |
Syria | Damascus | Asia | 185180.0 |
Turks and Caicos Islands | Cockburn Town | Americas | 948.0 |
Chad | N'Djamena | Africa | 1284000.0 |
Togo | Lomé | Africa | 56785.0 |
Thailand | Bangkok | Asia | 513120.0 |
Tajikistan | Dushanbe | Asia | 143100.0 |
Tokelau | Fakaofo | Oceania | 12.0 |
Turkmenistan | Ashgabat | Asia | 488100.0 |
Timor-Leste | Dili | Asia | 14874.0 |
Tonga | Nuku'alofa | Oceania | 747.0 |
Trinidad and Tobago | Port of Spain | Americas | 5130.0 |
Tunisia | Tunis | Africa | 163610.0 |
Turkey | Ankara | Asia | 783562.0 |
Tuvalu | Funafuti | Oceania | 26.0 |
Taiwan | Taipei | Asia | 36193.0 |
Tanzania | Dodoma | Africa | 945087.0 |
Uganda | Kampala | Africa | 241550.0 |
Ukraine | Kyiv | Europe | 603500.0 |
United States Minor Outlying Islands | Americas | 34.2 | |
Uruguay | Montevideo | Americas | 181034.0 |
United States | Washington D.C. | Americas | 9372610.0 |
Uzbekistan | Tashkent | Asia | 447400.0 |
Vatican City | Vatican City | Europe | 0.44 |
Saint Vincent and the Grenadines | Kingstown | Americas | 389.0 |
Venezuela | Caracas | Americas | 916445.0 |
British Virgin Islands | Road Town | Americas | 151.0 |
United States Virgin Islands | Charlotte Amalie | Americas | 347.0 |
Vietnam | Hanoi | Asia | 331212.0 |
Vanuatu | Port Vila | Oceania | 12189.0 |
Wallis and Futuna | Mata-Utu | Oceania | 142.0 |
Samoa | Apia | Oceania | 2842.0 |
Yemen | Sana'a | Asia | 527968.0 |
South Africa | Pretoria, Bloemfontein, Cape Town | Africa | 1221037.0 |
Zambia | Lusaka | Africa | 752612.0 |
Zimbabwe | Harare | Africa | 390757.0 |