From 2417e0e90c25c870658145c1a58e828d43e57c7b Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Mon, 30 Jun 2014 16:21:57 -0400 Subject: [PATCH] grid top-level wildcards Signed-off-by: Bill Erickson --- Open-ILS/web/js/ui/default/staff/services/grid.js | 38 ++++++++++++----------- 1 file changed, 20 insertions(+), 18 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 a11c397f45..545312c3a6 100644 --- a/Open-ILS/web/js/ui/default/staff/services/grid.js +++ b/Open-ILS/web/js/ui/default/staff/services/grid.js @@ -957,7 +957,7 @@ angular.module('egGridMod', // position in the path. cols.expandPath = function(colSpec) { - var dotpath = colSpec.path.replace(/\.\*$/,''); + var dotpath = colSpec.path.replace(/\.?\*$/,''); var class_obj; if (colSpec.parentIdlClass) { @@ -972,22 +972,24 @@ angular.module('egGridMod', // find the IDL class definition for the last element in the // path before the .* - var class_obj; - for (var path_idx in path_parts) { - var part = path_parts[path_idx]; - var idl_field = class_obj.field_map[part]; - - // unless we're at the end of the list, this field should - // link to another class. - if (idl_field && idl_field['class'] && ( - idl_field.datatype == 'link' || - idl_field.datatype == 'org_unit')) { - class_obj = egCore.idl.classes[idl_field['class']]; - } else { - if (path_idx < (path_parts.length - 1)) { - // we ran out of classes to hop through before - // we ran out of path components - console.error("egGrid: invalid IDL path: " + path); + // an empty path_parts means expand the root class + if (path_parts) { + for (var path_idx in path_parts) { + var part = path_parts[path_idx]; + var idl_field = class_obj.field_map[part]; + + // unless we're at the end of the list, this field should + // link to another class. + if (idl_field && idl_field['class'] && ( + idl_field.datatype == 'link' || + idl_field.datatype == 'org_unit')) { + class_obj = egCore.idl.classes[idl_field['class']]; + } else { + if (path_idx < (path_parts.length - 1)) { + // we ran out of classes to hop through before + // we ran out of path components + console.error("egGrid: invalid IDL path: " + dotpath); + } } } } @@ -1056,7 +1058,7 @@ angular.module('egGridMod', var column = fromExpand ? colSpec : cols.cloneFromScope(colSpec); - if (column.path && column.path.match(/\*/)) + if (column.path && column.path.match(/\*$/)) return cols.expandPath(colSpec); if (!column.name) column.name = column.path; -- 2.11.0