Skip to content

Commit

Permalink
fix(edit): #3128 remove grid scrollbars when in deepedit to prevent a…
Browse files Browse the repository at this point in the history
…ny scrolling of parent container.

  Chrome would automatically trigger a scroll when at the end of the text and there was no way to avoid it
  • Loading branch information
swalters committed Jun 12, 2015
1 parent 9e995e9 commit 91077e8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/features/edit/js/gridEdit.js
Expand Up @@ -765,6 +765,7 @@
}

function endEdit(retainFocus) {
$scope.grid.disableScrolling = false;
if (!inEdit) {
return;
}
Expand All @@ -779,6 +780,7 @@
}

function cancelEdit() {
$scope.grid.disableScrolling = false;
if (!inEdit) {
return;
}
Expand Down Expand Up @@ -867,9 +869,13 @@
$scope.deepEdit = false;
};


$elm.on('click', function (evt) {
if ($elm[0].type !== 'checkbox') {
$scope.deepEdit = true;
$timeout(function () {
$scope.grid.disableScrolling = true;
});
}
});

Expand Down
6 changes: 5 additions & 1 deletion src/js/core/factories/Grid.js
Expand Up @@ -126,6 +126,10 @@ angular.module('ui.grid')
*/
self.scrollDirection = uiGridConstants.scrollDirection.NONE;

//if true, grid will not respond to any scroll events
self.disableScrolling = false;


function vertical (scrollEvent) {
self.isScrollingVertically = false;
self.api.core.raise.scrollEnd(scrollEvent);
Expand Down Expand Up @@ -313,7 +317,7 @@ angular.module('ui.grid')
* @param {number} priority the priority of this processor. In general we try to do them in 100s to leave room
* for other people to inject rows processors at intermediate priorities. Lower priority rowsProcessors run earlier.
*
* At present allRowsVisible is running at 50, sort manipulations running at 60-65, filter is running at 100,
* At present allRowsVisible is running at 50, sort manipulations running at 60-65, filter is running at 100,
* sort is at 200, grouping and treeview at 400-410, selectable rows at 500, pagination at 900 (pagination will generally want to be last)
*/
self.api.registerMethod( 'core', 'registerRowsProcessor', this.registerRowsProcessor );
Expand Down
6 changes: 6 additions & 0 deletions src/js/core/factories/GridRenderContainer.js
Expand Up @@ -719,6 +719,12 @@ angular.module('ui.grid')
var self = this;
var styles = {};

if (self.grid.disableScrolling) {
styles['overflow-x'] = 'hidden';
styles['overflow-y'] = 'hidden';
return styles;
}

if (self.name === 'body') {
styles['overflow-x'] = self.grid.options.enableHorizontalScrollbar === uiGridConstants.scrollbars.NEVER ? 'hidden' : 'scroll';
if (!self.grid.isRTL()) {
Expand Down

0 comments on commit 91077e8

Please sign in to comment.