The sorting feature allows you to sort rows based on column values or expressions. You can use the allowSorting property or configure expressions to implement sorting.
Use the following code to apply sorting.
These steps assume that you have already initialized the grid and defined the columns. See Creating a Basic Grid and Defining Columns for additional information.
Set the allowSorting property and initialize the grid using the DIV tag.
new GC.DataViews.GridLayout({
allowSorting: true,
});
You can specify built-in sorting expressions to enable sorting when the data view loads.
Use the following steps to apply built-in sorting expressions.
These steps assume that you have already initialized the grid and defined the columns. See Creating a Basic Grid and Defining Columns for additional information.
Set the sorting property and initialize the grid using the DIV tag.
dataView.sorting = [
{
field: 'date',
ascending: true,
},
{
field: 'country',
ascending: false,
},
];
Submit and view feedback for