代码语言:javascript复制
import tornadofx.*
class MainView18 : View("pagination") {
val persions = (1..10).map {
"name${it}"
}.asObservable()
val tbl=tableview(persions){
column("name",String::class){
value { it.value }
}
}
val rowPerPage=3
val pg=pagination(persions.size/rowPerPage 1,0){
setPageFactory {
borderpane{
center=tbl.apply {
val fromIndex=currentPageIndex*rowPerPage
val toIndex=Math.min(fromIndex rowPerPage,persions.size)
items=persions.subList(fromIndex,toIndex).asObservable()
}
prefHeight=200.0
}
}
}