Skip to content

Commit 713f274

Browse files
committed
Add nestedRowsLimit parameter to DisplayConfiguration
1 parent 743bcb9 commit 713f274

File tree

1 file changed

+3
-2
lines changed
  • core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io

1 file changed

+3
-2
lines changed

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/io/html.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ internal fun AnyFrame.toHtmlData(
121121
val queue = LinkedList<Pair<AnyFrame, Int>>()
122122

123123
fun AnyFrame.columnToJs(col: AnyCol, rowsLimit: Int): ColumnDataForJs {
124-
val values = rows().take(rowsLimit)
124+
val values = if (rowsLimit == Int.MAX_VALUE) rows() else rows().take(rowsLimit)
125125
val scale = if (col.isNumber()) col.asNumbers().scale() else 1
126126
val format = if (scale > 0) {
127127
RendererDecimalFormat.fromPrecision(scale)
@@ -158,7 +158,7 @@ internal fun AnyFrame.toHtmlData(
158158
queue.add(this to rootId)
159159
while (!queue.isEmpty()) {
160160
val (nextDf, nextId) = queue.pop()
161-
val rowsLimit = if (nextId == rootId) configuration.rowsLimit else 5
161+
val rowsLimit = if (nextId == rootId) configuration.rowsLimit else configuration.nestedRowsLimit
162162
val preparedColumns = nextDf.columns().map { nextDf.columnToJs(it, rowsLimit) }
163163
val js = tableJs(preparedColumns, nextId, rootId, nextDf.nrow)
164164
scripts.add(js)
@@ -211,6 +211,7 @@ public fun <T> DataFrame<T>.toHTML(
211211

212212
public data class DisplayConfiguration(
213213
var rowsLimit: Int = 20,
214+
var nestedRowsLimit: Int = 5,
214215
var cellContentLimit: Int = 40,
215216
var cellFormatter: RowColFormatter<*, *>? = null,
216217
var decimalFormat: RendererDecimalFormat = RendererDecimalFormat.DEFAULT,

0 commit comments

Comments
 (0)