=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2013-04-24 08:54:41 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2013-04-24 13:07:12 +0000 @@ -57,6 +57,9 @@ function showOfflineEvents() { DAO.offlineData.fetchAll(function(store, arr) { + var orgUnitId = selection.getSelected(); + var programId = $('#programId').val(); + var target = $( '#offlineEventList' ); target.children().remove(); @@ -65,10 +68,13 @@ $.each( arr, function ( idx, item ) { var event = item.executionDate; - event.index = idx + 1; - var tmpl = _.template( template.html() ); - var html = tmpl(event); - target.append( html ); + + if ( event.organisationUnitId == orgUnitId && event.programId == programId ) { + event.index = idx + 1; + var tmpl = _.template( template.html() ); + var html = tmpl( event ); + target.append( html ); + } } ); $( "#offlineListDiv table" ).removeClass( 'hidden' ); @@ -276,6 +282,8 @@ updateProgramList( programs ); } ); + + showOfflineEvents(); } function updateProgramList( arr ) { @@ -366,6 +374,8 @@ } ).fail(function() { enable( 'addBtn' ); }); + + showOfflineEvents(); } function dataElementOnChange( this_ ) {