How to get the count of columns in a table component

Very simple question, I won't go in depth about my use case here but I am struggling to store the count of columns in a variable.

I stored the row count of the table by using {{table.displayedData.length}} but cannot seem to find a way to get the columns as well.

Is the table based on a query result set that populates it or are you adding additional columns using other logic to that table?
I tried this
{{formatDataAsArray(table5.columnMappers).length}}
And it seems to work... but @bradlymathews seems like the proper way to go at it!

1 Like

This will get you the total number of columns in the table's source:

Object.keys(myTable.data).length

But if you just want the number of displayed columns, which I assume you do from your example, use this:

Object.keys(myTable.displayedData).length
2 Likes

Thank you!

This works as well thank you for the fast response!