Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
Ignite UI - Angular 2, column sorting does not work without a primary key
posted

Hi, I am using Angular 2 igGrid. I am experiencing an issue where sorting on a column doesn't work if a primary key is not provided in the gridOptions.

From the documentation, a primary key is not required in the example:

http://www.igniteui.com/help/api/2016.1/ui.iggridsorting

Clicking on any column header would reduce the number of records to a single row.

The data that I have can contain duplicates in each of the columns. If I send in the key for a column with duplicates, the same sorting issue occurs.

If a primary key is required for the sorting to work properly, should I create a surrogate key as a primary key and hide that column?

Thanks!

-Jessica

this.gridOptions = {
dataSource: this.gridData,
width: "100%",
height: "400px",
autoGenerateColumns: false,
primaryKey: "a",
columns: [
{ key: "a", headerText: "A", width: "30%", dataType: "string" },
{ key: "b", headerText: "B", width: "40%", dataType: "string" },
{ key: "c", headerText: "C", width: "30%", dataType: "string" },
],
features: [
{
name: "Paging",
pageSizeDropDownLocation: "inpager"
},
{
name: "Sorting"
}
]
}

Parents Reply Children
No Data