Angular UI Components Documentation
This tutorial connects two grids through signals: selecting a customer in the first grid shows that customer's orders in the second, with a heading and totals computed from the same signal. It is the usual shape of a master-detail screen.

Use an Angular CLI app set up as in Angular CLI with jQWidgets. The section on inputs in Sorting, filtering and paging explains why the master grid's inputs never change.
With selectionmode: 'singlerow', the grid raises rowselect when a row is selected. The template listens with (onRowselect); the event's args.row holds the row's data, and the handler puts it in a signal:
<jqxGrid #customersGrid
[theme]="'fluent'"
[width]="'100%'"
[autoheight]="true"
[source]="customerSource"
[columns]="customerColumns"
[selectionmode]="'singlerow'"
(onRowselect)="select($event)">
</jqxGrid>
export class App {
// …
select(event: RowSelectEvent): void {
this.customer.set(event.args.row);
}
// …
}
The outputs of jqwidgets-ng are typed any, so the example declares the part of the event it reads (RowSelectEvent). The master grid's inputs are fields that never change, so a new selection changes the signal and nothing else: the master grid keeps its data and shows the row as selected.
While no row is selected, a click on one of the master grid's column headers also selects its first row. jqxGrid 27 selects a starting row when it receives the focus, for keyboard users, and reports it with rowselect like any other selection.
Everything that depends on the selected customer is a computed() signal: the customer's id, the orders, the totals, and the detail grid's source.
export class App {
// …
// The selected customer: the one piece of state both grids depend on.
readonly customer = signal<Customer | null>(null);
// A computed signal notifies its readers only when its value changes, so everything
// below follows the customer's id, not every new object for the same customer.
readonly customerId = computed(() => this.customer()?.id);
readonly orders = computed(() => orders.filter((o) => o.customerId === this.customerId()));
readonly totals = computed(() => ({
count: this.orders().length,
sum: this.orders().reduce((sum, o) => sum + o.total, 0)
}));
// The detail grid's source: a new adapter, and a new binding, only when the orders change.
readonly orderSource = computed(
() =>
new jqx.dataAdapter({
localdata: this.orders(),
datatype: 'array',
id: 'id',
datafields: [
{ name: 'id', type: 'number' },
{ name: 'date', type: 'date' },
{ name: 'product', type: 'string' },
{ name: 'quantity', type: 'number' },
{ name: 'total', type: 'number' }
]
})
);
// …
}
A computed signal notifies its readers only when its value changes. customerId is a string, so orders, and with it orderSource, are computed again only when another customer is selected. Each time, the detail grid's [source] input gets a new adapter and the grid binds to the customer's orders.
Here the orders are already in memory. With a server, make the adapter's url from the id (for example `/api/customers/${this.customerId()}/orders`) and the detail grid loads them when the selection changes.
The detail section exists only while a customer is selected. @if (customer(); as selected) creates it, the detail grid included, with the first selection, and keeps it while the selection moves from one customer to another.
@if (customer(); as selected) {
<section>
<h2>Orders of {{ selected.company }}, {{ selected.city }}</h2>
<p>
{{ totals().count }} orders, {{ totals().sum | currency: 'USD' }} in total
<button type="button" (click)="clear()">Close</button>
</p>
<jqxGrid
[theme]="'fluent'"
[width]="'100%'"
[autoheight]="true"
[source]="orderSource()"
[columns]="orderColumns">
</jqxGrid>
</section>
} @else {
<p>Select a customer to see their orders.</p>
}
Close clears the master grid's selection and sets the signal to null. The @if block then destroys the detail grid's component, and the component destroys its widget: there is nothing to clean up by hand.
export class App {
// …
clear(): void {
this.customersGrid().clearselection();
this.customer.set(null);
}
}
src/app/app.ts:
import { CurrencyPipe } from '@angular/common';
import { Component, computed, signal, viewChild } from '@angular/core';
import { jqxGridComponent, jqxGridModule } from 'jqwidgets-ng/jqxgrid';
interface Customer {
id: string;
company: string;
contact: string;
city: string;
country: string;
}
interface Order {
id: number;
customerId: string;
date: Date;
product: string;
quantity: number;
total: number;
}
// A grid event carries its details in event.args.
interface RowSelectEvent {
args: { rowindex: number; row: Customer };
}
const customers: Customer[] = [
{
id: 'ALFKI',
company: 'Alfreds Futterkiste',
contact: 'Maria Anders',
city: 'Berlin',
country: 'Germany'
},
{
id: 'BONAP',
company: 'Bon app',
contact: 'Laurence Lebihan',
city: 'Marseille',
country: 'France'
},
{
id: 'ERNSH',
company: 'Ernst Handel',
contact: 'Roland Mendel',
city: 'Graz',
country: 'Austria'
},
{
id: 'FRANK',
company: 'Frankenversand',
contact: 'Peter Franken',
city: 'München',
country: 'Germany'
},
{
id: 'QUEDE',
company: 'Que Delícia',
contact: 'Bernardo Batista',
city: 'Rio de Janeiro',
country: 'Brazil'
},
{
id: 'WILMK',
company: 'Wilman Kala',
contact: 'Matti Karttunen',
city: 'Helsinki',
country: 'Finland'
}
];
const products = ['Chai', 'Chang', 'Ikura', 'Konbu', 'Tofu', 'Pavlova'];
const orders: Order[] = Array.from({ length: 60 }, (_, i) => {
const quantity = 1 + ((i * 7) % 15);
return {
id: 10248 + i,
customerId: customers[(i * 5) % customers.length].id,
date: new Date(2026, i % 9, 1 + ((i * 3) % 27)),
product: products[(i * 11) % products.length],
quantity,
total: quantity * (4 + ((i * 13) % 30))
};
});
@Component({
selector: 'app-root',
imports: [jqxGridModule, CurrencyPipe],
templateUrl: './app.html'
})
export class App {
readonly customersGrid = viewChild.required<jqxGridComponent>('customersGrid');
// The selected customer: the one piece of state both grids depend on.
readonly customer = signal<Customer | null>(null);
// A computed signal notifies its readers only when its value changes, so everything
// below follows the customer's id, not every new object for the same customer.
readonly customerId = computed(() => this.customer()?.id);
readonly orders = computed(() => orders.filter((o) => o.customerId === this.customerId()));
readonly totals = computed(() => ({
count: this.orders().length,
sum: this.orders().reduce((sum, o) => sum + o.total, 0)
}));
// The detail grid's source: a new adapter, and a new binding, only when the orders change.
readonly orderSource = computed(
() =>
new jqx.dataAdapter({
localdata: this.orders(),
datatype: 'array',
id: 'id',
datafields: [
{ name: 'id', type: 'number' },
{ name: 'date', type: 'date' },
{ name: 'product', type: 'string' },
{ name: 'quantity', type: 'number' },
{ name: 'total', type: 'number' }
]
})
);
readonly customerSource = new jqx.dataAdapter({
localdata: customers,
datatype: 'array',
id: 'id',
datafields: [
{ name: 'id', type: 'string' },
{ name: 'company', type: 'string' },
{ name: 'contact', type: 'string' },
{ name: 'city', type: 'string' },
{ name: 'country', type: 'string' }
]
});
readonly customerColumns: jqwidgets.GridColumn[] = [
{ text: 'Company', datafield: 'company', width: 200 },
{ text: 'Contact', datafield: 'contact', width: 160 },
{ text: 'City', datafield: 'city', width: 130 },
{ text: 'Country', datafield: 'country' }
];
readonly orderColumns: jqwidgets.GridColumn[] = [
{ text: 'Order', datafield: 'id', width: 80 },
{ text: 'Date', datafield: 'date', cellsformat: 'yyyy-MM-dd', width: 120 },
{ text: 'Product', datafield: 'product', width: 140 },
{ text: 'Quantity', datafield: 'quantity', cellsalign: 'right', align: 'right', width: 90 },
{
text: 'Total',
datafield: 'total',
cellsformat: 'c2',
cellsalign: 'right',
align: 'right'
}
];
select(event: RowSelectEvent): void {
this.customer.set(event.args.row);
}
// Closing the detail removes its grid from the page: the @if block destroys the
// component, and the component destroys its widget.
clear(): void {
this.customersGrid().clearselection();
this.customer.set(null);
}
}
src/app/app.html:
<h1>Customers</h1>
<jqxGrid #customersGrid
[theme]="'fluent'"
[width]="'100%'"
[autoheight]="true"
[source]="customerSource"
[columns]="customerColumns"
[selectionmode]="'singlerow'"
(onRowselect)="select($event)">
</jqxGrid>
@if (customer(); as selected) {
<section>
<h2>Orders of {{ selected.company }}, {{ selected.city }}</h2>
<p>
{{ totals().count }} orders, {{ totals().sum | currency: 'USD' }} in total
<button type="button" (click)="clear()">Close</button>
</p>
<jqxGrid
[theme]="'fluent'"
[width]="'100%'"
[autoheight]="true"
[source]="orderSource()"
[columns]="orderColumns">
</jqxGrid>
</section>
} @else {
<p>Select a customer to see their orders.</p>
}
Select Ernst Handel: the heading reads Orders of Ernst Handel, Graz, the detail grid lists ten orders and the summary reads 10 orders, $1,780.00 in total. Select another customer and the detail follows, while the first grid keeps the row you selected highlighted. Close removes the detail.