webstaff: fix issue loading egGrid config
authorMike Rylander <mrylander@gmail.com>
Mon, 28 Sep 2015 16:41:13 +0000 (12:41 -0400)
committerKathy Lussier <klussier@masslnc.org>
Tue, 2 Feb 2016 19:58:47 +0000 (14:58 -0500)
Grid saveConfig can generate bad data (not sure how)
but we will avoid duplicates in loadConfig

Signed-off-by: Mike Rylander <mrylander@gmail.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Kathy Lussier <klussier@masslnc.org>

Open-ILS/web/js/ui/default/staff/services/grid.js

index 66a2bf3..4e48f93 100644 (file)
@@ -450,7 +450,12 @@ angular.module('egGridMod',
                         grid_col.sort = col.sort || 0;
                         // all saved columns are assumed to be true
                         grid_col.visible = true;
-                        new_cols.push(grid_col);
+                        if (new_cols
+                                .filter(function (c) {
+                                    return c.name == grid_col.name;
+                                }).length == 0
+                        )
+                            new_cols.push(grid_col);
                     });
 
                     // columns which are not expressed within the saved