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
1085
Can't sort on a hidden column
posted

We have a hidden column that we require our grids to be sorted on. The column contains information that the user cannot see or interact with.

The problem is that if we call igGridSorting("sortColumn" on this hidden column, a javascript exception is thrown.

I have traced the problem down to the following code in infragistics.ui.grid.sorting.js:

					// M.H. 19 July 2012 Fix for bug #113505
					if (this.grid._detachedHeaderCells && isSingleMode && cs[i].columnKey && this.grid._detachedHeaderCells[cs[i].columnKey]) {
						if (cs[i].currentSortDirection !== undefined && cs[i].currentSortDirection !== null) {
							delete cs[i].currentSortDirection;
						}

It seems that any column specified as a hidden column is added to the detachedHeaderCells array, which causes the sorting on the column to be removed, leading to js exception when subsequent code tries to access to currentSortDirection.
Changing the column to unhidden resolves the issue, but breaks our application requirement.
Has this been fixed or is there any workaround to prevent adding the hidden sort column to the detachedHeaderCells array?
(We have to use programmatic sort after inserting a row because inserting an entry directly into the datasource results in a loss of the transaction data for that row.)