Skip to main content

table.getAllViews()?

  • June 10, 2020
  • 1 reply
  • 0 views

Forum|alt.badge.img+4

I know there is getView(‘ViewName’) to retrieve a particuilar view of a table, but what if you don’t know the name of a view, or how many views there are?

Is there a way to fetch ALL the views of a given table? Something like this:

let table = base.getTable("TableName");
let allViews = table.getAllViews(); // something like this?
output.inspect(allViews);

I have a custom Vue app and want to display a table’s records and then populate a navbar with all the views so a user can click links to switch the table view.

1 reply

Justin_Barrett
Forum|alt.badge.img+20

Once you have a table, there is a views property for that table, which is an array of all views for the table. Here’s the code example from the docs:

// Show an interactive inspector for every view in "Borrower"
let table = base.getTable("Borrower");
for (let view of table.views) {
    output.inspect(view);
}

Reply