=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js 2015-05-19 13:12:31 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-reports/scripts/core.js 2015-05-21 15:32:20 +0000 @@ -1969,6 +1969,60 @@ support.prototype.array.sort(objects, 'ASC', 'sortingId'); header.ids = Ext.Array.pluck(objects, 'id'); } + else if (header.type === 'java.lang.Boolean') { + var objects = []; + + for (var k = 0, id, fullId, name, isHierarchy; k < response.rows.length; k++) { + id = response.rows[k][i] || emptyId; + + // hide NA data + if (xLayout.hideNaData && id === emptyId) { + continue; + } + + fullId = header.name + id; + isHierarchy = service.layout.isHierarchy(xLayout, response, id); + + // add dimension name prefix if not pe/ou + name = isMeta ? '' : header.column + ' '; + + // add hierarchy if ou and showHierarchy + name = isHierarchy ? service.layout.getHierarchyName(ouHierarchy, names, id) : (names[id] || id); + + names[fullId] = name; + + // update rows + response.rows[k][i] = fullId; + + // update ou hierarchy + if (isHierarchy) { + ouHierarchy[fullId] = ouHierarchy[id]; + } + + // update boolean metadata + response.metaData.booleanNames[id] = booleanNameMap[id]; + response.metaData.booleanNames[fullId] = booleanNameMap[id]; + + objects.push({ + id: fullId, + sortingId: id + }); + } + + // sort + objects.sort(function(a, b) { + if (a.sortingId === emptyId) { + return 1; + } + else if (b.sortingId === emptyId) { + return -1; + } + + return a.sortingId - b.sortingId; + }); + + header.ids = Ext.Array.pluck(objects, 'id'); + } else if (header.name === 'pe') { var selectedItems = xLayout.dimensionNameIdsMap['pe'], isRelative = false; @@ -2016,15 +2070,9 @@ ouHierarchy[fullId] = ouHierarchy[id]; } - // update boolean metadata - if (header.type === 'java.lang.Boolean') { - response.metaData.booleanNames[id] = booleanNameMap[id]; - response.metaData.booleanNames[fullId] = booleanNameMap[id]; - } - objects.push({ id: fullId, - sortingId: header.name === 'pe' ? fullId : name + sortingId: name }); } === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js 2015-05-13 16:59:59 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-event-visualizer/scripts/core.js 2015-05-21 15:34:29 +0000 @@ -2612,6 +2612,60 @@ support.prototype.array.sort(objects, 'ASC', 'sortingId'); header.ids = Ext.Array.pluck(objects, 'id'); } + else if (header.type === 'java.lang.Boolean') { + var objects = []; + + for (var k = 0, id, fullId, name, isHierarchy; k < response.rows.length; k++) { + id = response.rows[k][i] || emptyId; + + // hide NA data + if (xLayout.hideNaData && id === emptyId) { + continue; + } + + fullId = header.name + id; + isHierarchy = service.layout.isHierarchy(xLayout, response, id); + + // add dimension name prefix if not pe/ou + name = isMeta ? '' : header.column + ' '; + + // add hierarchy if ou and showHierarchy + name = isHierarchy ? service.layout.getHierarchyName(ouHierarchy, names, id) : (names[id] || id); + + names[fullId] = name; + + // update rows + response.rows[k][i] = fullId; + + // update ou hierarchy + if (isHierarchy) { + ouHierarchy[fullId] = ouHierarchy[id]; + } + + // update boolean metadata + response.metaData.booleanNames[id] = booleanNameMap[id]; + response.metaData.booleanNames[fullId] = booleanNameMap[id]; + + objects.push({ + id: fullId, + sortingId: id + }); + } + + // sort + objects.sort(function(a, b) { + if (a.sortingId === emptyId) { + return 1; + } + else if (b.sortingId === emptyId) { + return -1; + } + + return a.sortingId - b.sortingId; + }); + + header.ids = Ext.Array.pluck(objects, 'id'); + } else if (header.name === 'pe') { var selectedItems = xLayout.dimensionNameIdsMap['pe'], isRelative = false; @@ -2659,15 +2713,9 @@ ouHierarchy[fullId] = ouHierarchy[id]; } - // update boolean metadata - if (header.type === 'java.lang.Boolean') { - response.metaData.booleanNames[id] = booleanNameMap[id]; - response.metaData.booleanNames[fullId] = booleanNameMap[id]; - } - objects.push({ id: fullId, - sortingId: header.name === 'pe' ? fullId : name + sortingId: name }); }