Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Headers Not Being Set Correctly? #3

Open
haydndup opened this issue Jan 15, 2025 · 0 comments
Open

Headers Not Being Set Correctly? #3

haydndup opened this issue Jan 15, 2025 · 0 comments

Comments

@haydndup
Copy link

haydndup commented Jan 15, 2025

Hello 👋 ,

I recently upgraded to tada 0.2.0 from 0.1.0, and I've encountered an issue with repeating headers. In tada 0.1.0, this was done with repeat-header: true, but in tada 0.2.0, this does not work since the underlying switch from tablex to table.

In theory, the typst built-in tables should by default repeat the headers (https://typst.app/docs/reference/model/table/#definitions-header). But, using this code, I am unable to get the headers to repeat:

#let create-technology-table(
  filter-jurisdiction: none
  ) = {

    let rows = csv("../data/platform-technologies.csv")
    let headers = rows.remove(0)

    let table-data = tada.from-rows(
      rows, 
      field-info: headers, 
      field-defaults: (title: helpers.table-header-format),
      table-kwargs: helpers.table-default-kwargs()
    )

  // [Trimmed extra stuff for this example]

   tada.to-table(
      table-data, 
      // repeat-header: true,  // <-- this worked in tada 0.1.0
    )

}

helpers.typ has the following defined:

#let default-row-style-mapper = (x, y) => {
  let fill = none
  if y == 0 {
    rgb("#29e28c")
  } else if calc.even(y) {
    rgb("#e9fcf3")
  } else {
    none
  }
}

#let table-default-kwargs = () => {
  return (
    stroke: (x: none, y: rgb("#07665E")),
    fill: default-row-style-mapper,
  )
}

I'm passing in the headers using field-info, which I thought tada would then use to set the table's underlying header, but this does not seem to be the case.

Is there any way I can get the table header to repeat? I've tried passing things into table-kwargs too, but this didn't work.

Thank you 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant