rsanchez
2014-12-05 ab47678d768178de568d09b1a8c53470527af1a3
securis/src/main/webapp/js/catalogs.js
....@@ -87,11 +87,12 @@
8787 * number it find it by position
8888 */
8989 this.getMetadata = function(index) {
90
- if (!_metadata)
91
- throw new Error(
92
- 'There is no catalog metadata info');
93
- if (index === undefined)
90
+ if (!_metadata) {
91
+ throw new Error('There is no catalog metadata info');
92
+ }
93
+ if (index === undefined) {
9494 return _current;
95
+ }
9596 if (typeof index === 'string') {
9697 for (var i = _metadata.length - 1; i >= 0
9798 && _metadata[i].resource !== index; i--)
....@@ -217,13 +218,14 @@
217218 }
218219 this.loadRefs = function(callback, refsFields) {
219220 if (!refsFields || refsFields.length === 0) {
220
- if (!_current)
221
+ if (!_current) {
221222 throw new Error('There is no current catalog selected');
223
+ }
222224 refsFields = [];
223225 _current.fields.forEach(function(f) {
224
- if (f.resource)
225
- refsFields.push(f)
226
-
226
+ if (f.resource) {
227
+ refsFields.push(f);
228
+ }
227229 });
228230 }
229231
....@@ -248,6 +250,7 @@
248250 refs[rf.name].forEach(function(row) {
249251 comboData.push({
250252 id : row[pk],
253
+ code : row.code,
251254 label : row.label
252255 || row.name
253256 || row.code