Skip to content

Commit

Permalink
Add custom events for "pageLoaded" and "tableBuilt"
Browse files Browse the repository at this point in the history
Dispatch custom events "pageLoadedTabulator" and "tableBuiltTabulator" to enhance integration flexibility. These events provide additional hooks for external systems to react to Tabulator state changes.
  • Loading branch information
tfonrouge committed Jan 3, 2025
1 parent c05e694 commit e92f7e6
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -291,14 +291,15 @@ open class Tabulator<T : Any>(
}, 0)
}
}
jsTabulator?.on("pageLoaded") {
jsTabulator?.on("pageLoaded") { pageNo: Int ->
paginations.forEach {
it.paginationState.value = PaginationState(
jsTabulator?.getPage()?.unsafeCast<Int>() ?: 1,
jsTabulator?.getPageMax()?.unsafeCast<Int>() ?: 1,
jsTabulator?.options?.paginationButtonCount?.unsafeCast<Int>() ?: 5
)
}
this.dispatchEvent("pageLoadedTabulator", obj { detail = pageNo })
}
jsTabulator?.on("tableBuilt") {
if (currentPage != null) {
Expand All @@ -307,6 +308,7 @@ open class Tabulator<T : Any>(
}
applyFilter()
jsTabulatorInitialized = true
this.dispatchEvent("tableBuiltTabulator", obj { })
}
}
}
Expand Down

0 comments on commit e92f7e6

Please sign in to comment.