Skip to content

Commit 91077e8

Browse files
committed
fix(edit): #3128 remove grid scrollbars when in deepedit to prevent any 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
1 parent 9e995e9 commit 91077e8

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

Diff for: src/features/edit/js/gridEdit.js

+6
Original file line numberDiff line numberDiff line change
@@ -765,6 +765,7 @@
765765
}
766766

767767
function endEdit(retainFocus) {
768+
$scope.grid.disableScrolling = false;
768769
if (!inEdit) {
769770
return;
770771
}
@@ -779,6 +780,7 @@
779780
}
780781

781782
function cancelEdit() {
783+
$scope.grid.disableScrolling = false;
782784
if (!inEdit) {
783785
return;
784786
}
@@ -867,9 +869,13 @@
867869
$scope.deepEdit = false;
868870
};
869871

872+
870873
$elm.on('click', function (evt) {
871874
if ($elm[0].type !== 'checkbox') {
872875
$scope.deepEdit = true;
876+
$timeout(function () {
877+
$scope.grid.disableScrolling = true;
878+
});
873879
}
874880
});
875881

Diff for: src/js/core/factories/Grid.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,10 @@ angular.module('ui.grid')
126126
*/
127127
self.scrollDirection = uiGridConstants.scrollDirection.NONE;
128128

129+
//if true, grid will not respond to any scroll events
130+
self.disableScrolling = false;
131+
132+
129133
function vertical (scrollEvent) {
130134
self.isScrollingVertically = false;
131135
self.api.core.raise.scrollEnd(scrollEvent);
@@ -313,7 +317,7 @@ angular.module('ui.grid')
313317
* @param {number} priority the priority of this processor. In general we try to do them in 100s to leave room
314318
* for other people to inject rows processors at intermediate priorities. Lower priority rowsProcessors run earlier.
315319
*
316-
* At present allRowsVisible is running at 50, sort manipulations running at 60-65, filter is running at 100,
320+
* At present allRowsVisible is running at 50, sort manipulations running at 60-65, filter is running at 100,
317321
* sort is at 200, grouping and treeview at 400-410, selectable rows at 500, pagination at 900 (pagination will generally want to be last)
318322
*/
319323
self.api.registerMethod( 'core', 'registerRowsProcessor', this.registerRowsProcessor );

Diff for: src/js/core/factories/GridRenderContainer.js

+6
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,12 @@ angular.module('ui.grid')
719719
var self = this;
720720
var styles = {};
721721

722+
if (self.grid.disableScrolling) {
723+
styles['overflow-x'] = 'hidden';
724+
styles['overflow-y'] = 'hidden';
725+
return styles;
726+
}
727+
722728
if (self.name === 'body') {
723729
styles['overflow-x'] = self.grid.options.enableHorizontalScrollbar === uiGridConstants.scrollbars.NEVER ? 'hidden' : 'scroll';
724730
if (!self.grid.isRTL()) {

0 commit comments

Comments
 (0)