Sorting the parent rows of a Ant Design Table

193 Views Asked by At

I have a table with two levels:

1-row
  1-1-child-row
  1-2-child-row
2-row
3-row

What I want to do is to add a sorter to some columns. This sorter should only sort the first level.

Using a sorter gives me:

Uncaught org.scalajs.linker.runtime.UndefinedBehaviorError: java.lang.ClassCastException: undefined is not an instance of java.lang.Double

I use Scala.js (reduced the example that it does not much anymore):

ColumnType[TableRow]
  .setTitle("")
  .setDataIndex("icon")
  .setKey("icon")
  .setSorter(Compare((a: TableRow, b: TableRow, x) => 1.0, 1.1))

Here my dependencies (build.sbt):

lazy val antdSettings: Project => Project =
  _.settings(
    stFlavour := Flavour.Slinky,
    useYarn := true,
    stIgnore := List("react-proxy"),
    Compile / npmDependencies ++= Seq(
      "antd" -> "4.5.1",
      "@types/react" -> "16.9.42",
      "@types/react-dom" -> "16.9.8"
    )
  )

I tested this code with simple rows and it worked.

Do I miss something or is this not supported?

0

There are 0 best solutions below