diff --git a/etemplate/js/et2_core_arrayMgr.js b/etemplate/js/et2_core_arrayMgr.js index 9aa1b4f531..bd8c758d1a 100644 --- a/etemplate/js/et2_core_arrayMgr.js +++ b/etemplate/js/et2_core_arrayMgr.js @@ -107,6 +107,41 @@ var et2_arrayMgr = Class.extend( return null; },*/ + /** + * Explodes compound keys (eg IDs) into a list of namespaces + * This uses no internal values, just expands + * + * eg: + * a[b][c] => [a,b,c] + * col_filter[tr_tracker] => [col_filter, tr_tracker] + * + * @param {string} _key + * + * @return {string[]} + */ + explodeKey: function(_key) + { + // Parse the given key by removing the "]"-chars and splitting at "[" + var indexes = [_key]; + + if(typeof _key === "string") + { + _key = _key.replace(/[/g,"[").replace(/]/g,"]"); + indexes = _key.split('['); + } + if (indexes.length > 1) + { + indexes = [indexes.shift(), indexes.join('[')]; + indexes[1] = indexes[1].substring(0,indexes[1].length-1); + var children = indexes[1].split(']['); + if(children.length) + { + indexes = jQuery.merge([indexes[0]], children); + } + } + return indexes; + }, + /** * Returns the path to this content array manager perspective as an array * containing the key values @@ -155,26 +190,7 @@ var et2_arrayMgr = Class.extend( } // Parse the given key by removing the "]"-chars and splitting at "[" - var indexes = [_key]; - - if (this.splitIds) - { - if(typeof _key === "string") - { - _key = _key.replace(/[/g,"[").replace(/]/g,"]"); - indexes = _key.split('['); - } - if (indexes.length > 1) - { - indexes = [indexes.shift(), indexes.join('[')]; - indexes[1] = indexes[1].substring(0,indexes[1].length-1); - var children = indexes[1].split(']['); - if(children.length) - { - indexes = jQuery.merge([indexes[0]], children); - } - } - } + var indexes = this.explodeKey(_key); var entry = this.data; for (var i = 0; i < indexes.length; i++)