Skip to content

Commit

Permalink
fix(journal): disable cellNav on custom columns
Browse files Browse the repository at this point in the history
This commit disables cellNavigation on the plugin columns by getting
them by name and manually switching them off.  It uses a $timeout() hack
to try and guarantee this takes effect before the user is ready to click
on the page.
  • Loading branch information
Jonathan Niles committed Feb 23, 2017
1 parent c5a724b commit d8f9469
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion client/src/js/services/grid/TransactionService.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ function TransactionService($timeout, util, uiGridConstants, bhConstants, Notify
* @constructor
*/
function Transactions(gridOptions) {
// why is this number magic?
var MAGIC_NUMBER = 410;

// Silly columns that can be navigated to.
var GRID_PLUGIN_COLUMNS = ['treeBaseRowHeaderCol', 'selectionRowHeaderCol'];

this.gridOptions = gridOptions;

// a mapping of record_uuid -> array indices in the rendered row set
Expand All @@ -115,12 +121,25 @@ function TransactionService($timeout, util, uiGridConstants, bhConstants, Notify
if (this._entity) {
setPropertyOnTransaction.call(this, this._entity.uuid, ROW_EDIT_FLAG, true);
}

return rows;
}.bind(this), 410);
}.bind(this), MAGIC_NUMBER);

api.grid.registerDataChangeCallback(function (rows) {
createTransactionIndexMap.bind(scope)();
}, [uiGridConstants.dataChange.ROW]);

// FIXME(@jniles)?
// This $timeout hack is necessary to remove the cellNav
$timeout(function () {

GRID_PLUGIN_COLUMNS.forEach(function (name) {
var column = api.grid.getColumn(name);
column.colDef.allowCellFocus = false;
});

this.disableCellNavigation();
}.bind(this), MAGIC_NUMBER);
}.bind(this));
}

Expand Down

0 comments on commit d8f9469

Please sign in to comment.