Skip to content

Commit 07e78d5

Browse files
committed
Merge pull request #3710 from PaulL1/fixes
Fixes
2 parents a4500fd + 96d1d17 commit 07e78d5

File tree

4 files changed

+15
-12
lines changed

4 files changed

+15
-12
lines changed

src/features/resize-columns/js/ui-grid-column-resizer.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@
283283
</doc:source>
284284
<doc:scenario>
285285
// TODO: e2e specs?
286-
// TODO: Obey minWidth and maxWIdth;
287286
288287
// TODO: post-resize a horizontal scroll event should be fired
289288
</doc:scenario>
@@ -338,11 +337,11 @@
338337
var newWidth = width;
339338

340339
// If the new width would be less than the column's allowably minimum width, don't allow it
341-
if (col.colDef.minWidth && newWidth < col.colDef.minWidth) {
342-
newWidth = col.colDef.minWidth;
340+
if (col.minWidth && newWidth < col.minWidth) {
341+
newWidth = col.minWidth;
343342
}
344-
else if (col.colDef.maxWidth && newWidth > col.colDef.maxWidth) {
345-
newWidth = col.colDef.maxWidth;
343+
else if (col.maxWidth && newWidth > col.maxWidth) {
344+
newWidth = col.maxWidth;
346345
}
347346

348347
return newWidth;

src/features/selection/js/selection.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
*/
163163
toggleRowSelection: function (rowEntity, evt) {
164164
var row = grid.getRow(rowEntity);
165-
if (row !== null && row.enableSelection !== false) {
165+
if (row !== null) {
166166
service.toggleRowSelection(grid, row, evt, grid.options.multiSelect, grid.options.noUnselect);
167167
}
168168
},
@@ -176,7 +176,7 @@
176176
*/
177177
selectRow: function (rowEntity, evt) {
178178
var row = grid.getRow(rowEntity);
179-
if (row !== null && !row.isSelected && row.enableSelection !== false) {
179+
if (row !== null && !row.isSelected) {
180180
service.toggleRowSelection(grid, row, evt, grid.options.multiSelect, grid.options.noUnselect);
181181
}
182182
},
@@ -193,7 +193,7 @@
193193
*/
194194
selectRowByVisibleIndex: function ( rowNum, evt ) {
195195
var row = grid.renderContainers.body.visibleRowCache[rowNum];
196-
if (row !== null && typeof(row) !== 'undefined' && !row.isSelected && row.enableSelection !== false) {
196+
if (row !== null && typeof(row) !== 'undefined' && !row.isSelected) {
197197
service.toggleRowSelection(grid, row, evt, grid.options.multiSelect, grid.options.noUnselect);
198198
}
199199
},
@@ -460,6 +460,10 @@
460460
toggleRowSelection: function (grid, row, evt, multiSelect, noUnselect) {
461461
var selected = row.isSelected;
462462

463+
if ( row.enableSelection === false && !selected ){
464+
return;
465+
}
466+
463467
if (!multiSelect && !selected) {
464468
service.clearSelectedRows(grid, evt);
465469
} else if (!multiSelect && selected) {
@@ -472,7 +476,7 @@
472476

473477
if (selected && noUnselect){
474478
// don't deselect the row
475-
} else if (row.enableSelection !== false) {
479+
} else {
476480
row.setSelected(!selected);
477481
if (row.isSelected === true) {
478482
grid.selection.lastSelectedRow = row;

src/js/core/services/rowSearcher.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function escapeRegExp(str) {
1414
* @description Service for searching/filtering rows based on column value conditions.
1515
*/
1616
module.service('rowSearcher', ['gridUtil', 'uiGridConstants', function (gridUtil, uiGridConstants) {
17-
var defaultCondition = uiGridConstants.filter.STARTS_WITH;
17+
var defaultCondition = uiGridConstants.filter.CONTAINS;
1818

1919
var rowSearcher = {};
2020

test/unit/core/row-filtering.spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,10 +83,10 @@ describe('rowSearcher', function() {
8383
expect(rowSearcher.guessCondition(filter)).toEqual(re);
8484
});
8585

86-
it('should guess STARTS_WITH when term has no *s', function() {
86+
it('should guess CONTAINS when term has no *s', function() {
8787
var filter = { term: 'blah' };
8888

89-
expect(rowSearcher.guessCondition(filter)).toEqual(uiGridConstants.filter.STARTS_WITH, 'STARTS_WITH');
89+
expect(rowSearcher.guessCondition(filter)).toEqual(uiGridConstants.filter.CONTAINS, 'CONTAINS');
9090
});
9191

9292

0 commit comments

Comments
 (0)