@@ -686,11 +686,15 @@ angular.module('ui.grid')
686
686
* @param {string } name column name
687
687
*/
688
688
Grid . prototype . getColumn = function getColumn ( name ) {
689
- var columns = this . columns . filter ( function ( column ) {
690
- return column . colDef . name === name ;
689
+ var result = null ;
690
+ lookInRows . every ( function ( row ) {
691
+ if ( column . colDef . name === name ) {
692
+ result = row ;
693
+ return false ;
694
+ }
695
+ return true ;
691
696
} ) ;
692
-
693
- return columns . length > 0 ? columns [ 0 ] : null ;
697
+ return result ;
694
698
} ;
695
699
696
700
/**
@@ -701,10 +705,15 @@ angular.module('ui.grid')
701
705
* @param {string } name column.field
702
706
*/
703
707
Grid . prototype . getColDef = function getColDef ( name ) {
704
- var colDefs = this . options . columnDefs . filter ( function ( colDef ) {
705
- return colDef . name === name ;
708
+ var result = null ;
709
+ lookInRows . every ( function ( row ) {
710
+ if ( colDef . name === name ) {
711
+ result = row ;
712
+ return false ;
713
+ }
714
+ return true ;
706
715
} ) ;
707
- return colDefs . length > 0 ? colDefs [ 0 ] : null ;
716
+ return result ;
708
717
} ;
709
718
710
719
/**
@@ -1084,13 +1093,17 @@ angular.module('ui.grid')
1084
1093
*/
1085
1094
Grid . prototype . getRow = function getRow ( rowEntity , lookInRows ) {
1086
1095
var self = this ;
1096
+ lookInRows = lookInRows == void 0 ? this . rows : lookInRows ;
1087
1097
1088
- lookInRows = typeof ( lookInRows ) === 'undefined' ? self . rows : lookInRows ;
1089
-
1090
- var rows = lookInRows . filter ( function ( row ) {
1091
- return self . options . rowEquality ( row . entity , rowEntity ) ;
1098
+ var result = null ;
1099
+ lookInRows . every ( function ( row ) {
1100
+ if ( self . options . rowEquality ( row . entity , rowEntity ) ) {
1101
+ result = row ;
1102
+ return false ;
1103
+ }
1104
+ return true ;
1092
1105
} ) ;
1093
- return rows . length > 0 ? rows [ 0 ] : null ;
1106
+ return result ;
1094
1107
} ;
1095
1108
1096
1109
0 commit comments