Skip to content

How to render a table dynamically ? #2904

Closed Answered by picklelo
yellowbean asked this question in Q&A
Discussion options

You must be logged in to vote

@yellowbean your code is correct, you just need to add a type annotation to your var (so it knows that its a list of lists that it can foreach, without this you may get a Javascript error by iterating over a non-list type)

from typing import Any

class State(rx.State):
  tableData: list[list[Any]] = [["A",1],["B",2]]

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@picklelo
Comment options

Answer selected by yellowbean
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants