Skip to content

Commit 62ebd37

Browse files
committed
Merge pull request #4456 from nkoterba/patch-1
Update Grid.js modifyRows documentation to match function code
2 parents 79e7cf2 + a70d498 commit 62ebd37

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/js/core/factories/Grid.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1065,6 +1065,7 @@ angular.module('ui.grid')
10651065
* @methodOf ui.grid.class:Grid
10661066
* @description creates or removes GridRow objects from the newRawData array. Calls each registered
10671067
* rowBuilder to further process the row
1068+
* @param {array} newRawData Modified set of data
10681069
*
10691070
* This method aims to achieve three things:
10701071
* 1. the resulting rows array is in the same order as the newRawData, we'll call
@@ -1088,6 +1089,16 @@ angular.module('ui.grid')
10881089
*
10891090
* Rows are identified using the hashKey if configured. If not configured, then rows
10901091
* are identified using the gridOptions.rowEquality function
1092+
*
1093+
* This method is useful when trying to select rows immediately after loading data without
1094+
* using a $timeout/$interval, e.g.:
1095+
*
1096+
* $scope.gridOptions.data = someData;
1097+
* $scope.gridApi.grid.modifyRows($scope.gridOptions.data);
1098+
* $scope.gridApi.selection.selectRow($scope.gridOptions.data[0]);
1099+
*
1100+
* OR to persist row selection after data update (e.g. rows selected, new data loaded, want
1101+
* originally selected rows to be re-selected))
10911102
*/
10921103
Grid.prototype.modifyRows = function modifyRows(newRawData) {
10931104
var self = this;

0 commit comments

Comments
 (0)