toQuery

Use the toQuery method to transform an entity ORM object into a WireBootstrap TableQuery object.

TableQuery

The toQuery transform allows the functionality of the table query to be used with ORM objects.

The example below transforms the Categories ORM query for CategoryName into a table query. It then joins Categories with Products adding ProductName to the list of selected fields. Last, it executes the query directly against the Northwind data source.

...

let query = Categories.select(CategoriesField.CategoryName).toQuery();

query.field("ProductName")
    .join("Products", "CategoryId").on("Categories", "CategoryId");

const table: IWireDataTable = await Northwind.execAsync(query);

// print the first row to the console log
console.log(table.select().first());

// log-> { CategoryName: "Dairy Products", ProductName: "Queso Cabrales" }

Last updated