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.)
Hello Karl, I have opened a support ticket with ID - CAS-110268-R3B7V8 which is visible for you if you log in our website and go to Account > Support activity. We will continue our communication regarding the issue through the support ticket.
Even though the developers have stated this is "as designed", there is a trivial fix to the problem. Pass the current s in method sortColumn to _clearSortStates, then modify the following code in _clearSortStates:
// 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; } this._clearHeaderCellSortState(this.grid._detachedHeaderCells[cs[i].columnKey][0]); }to be:
// M.H. 19 July 2012 Fix for bug #113505 if (this.grid._detachedHeaderCells && isSingleMode && cs[i].columnKey && this.grid._detachedHeaderCells[cs[i].columnKey]) { if (typeof s != 'undefined' && s && cs[i].columnKey == s.columnKey) { // We are sorting on a hidden column and this is the hidden column, so don't clear the sort info } else { if (cs[i].currentSortDirection !== undefined && cs[i].currentSortDirection !== null) { delete cs[i].currentSortDirection; } this._clearHeaderCellSortState(this.grid._detachedHeaderCells[cs[i].columnKey][0]); } }