From ad87d0b11ac1530a7d7c07e4a089b8cf25851dba Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Wed, 14 Feb 2018 18:32:46 -0500 Subject: [PATCH] Lp 1749593: Fix TypeError: Cannot set property 'grid' of undefined Commit b35f0c0 added a reference to the grid in the grid.dataProvider in services/grid.js in the web staff client. This is great, but the dataProvider could be undefined where it was being set. This leads to busted grid views and a TypeError in the console. This commit moves the code down until after a fallback dataProvider is used when the dataProvider is undefined and thereby avoids both problems of adding the grid to an undefined dataProvider. Signed-off-by: Jason Stephenson Signed-off-by: Kathy Lussier --- Open-ILS/web/js/ui/default/staff/services/grid.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/services/grid.js b/Open-ILS/web/js/ui/default/staff/services/grid.js index 7144970bcf..17fc743615 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -178,9 +178,6 @@ angular.module('egGridMod', delete $scope.idField; grid.dataProvider = $scope.itemsProvider; - // make grid ref available in get() to set totalCount, if known. - // this allows us disable the 'next' paging button correctly - grid.dataProvider.grid = grid; if (!grid.indexField && grid.idlClass) grid.indexField = egCore.idl.classes[grid.idlClass].pkey; @@ -222,6 +219,10 @@ angular.module('egGridMod', }); } + // make grid ref available in get() to set totalCount, if known. + // this allows us disable the 'next' paging button correctly + grid.dataProvider.grid = grid; + grid.dataProvider.columnsProvider = grid.columnsProvider; $scope.itemFieldValue = grid.dataProvider.itemFieldValue; -- 2.43.2