Sorting

Sort feature allows you to decide about the order of elements presented in Generic UI grid. When sorting is enabled, all you have to do is to click on one of the column headers. After which, the elements will be reorganized in two ways:

  • ascending - one click on the column header,
  • descending - two clicks on the column header,
  • default - three clicks turns off sorting

The example below shows you how to turn on the sorting feature in the Generic UI Grid for Angular. Try to click on the column headers and see how the column values change places.

Name
Type
Price
T-shirtclothes15$Shoesfootwear100$Ball capheadgear50$
@Component({
	template: `
		<gui-grid [columns]="columns"
				  [source]="source"
				  [sorting]="sorting">
		</gui-grid>
	`
})
export class SortingComponent {

	sorting: GuiSorting = {
		enabled: true
	};

	// ...Rest of the component
}

Multi sorting

Generic UI data grid has a built-in multi sorting feature that allows you to have enabled more than one sorting function.

To enable the multi sorting function you have to add fallowing code multiSorting: true to the sorting configuration. Multi sorting works same as sorting, but it can be activated on multiple columns. The arrow seen in the column headers informs that the order of the column cells has been changed. It helps to monitor which column has had their cells rearranged.

Multi-sorting gives the ability to arrange data in a meaningful way.

Name
Type
Price
T-shirtclothes15$Shoesfootwear100$Ball capheadgear50$
@Component({
	selector: 'gweb-docs-sorting-multi',
	template: `
		<gui-grid [columns]="columns"
				  [source]="source"
				  [sorting]="sorting">
		</gui-grid>
	`
})
export class DocSortingMultiComponent {

	sorting: GuiSorting = {
		enabled: true,
		multiSorting: true
	};

	// ...Rest of the component

}

Related articles:

We use cookies to improve your experience. If you continue browsing, we assume that you consent to our use of cookies.