Permalink
Browse files

enhancement: ajax delete report from list

  • Loading branch information...
luisdias committed Mar 18, 2012
1 parent 18af151 commit a84f989bde7aaa1e44fd75ae404aef1f77103305
Showing with 26 additions and 0 deletions.
  1. +26 −0 webroot/js/index.js
View
@@ -44,4 +44,30 @@ $(document).ready(function() {
});
}
});
+
+ $('.deleteReport').click(function(){
+ var report = $('#ReportManagerSavedReportOption').val();
+ if ( report != '' && confirm('Are you sure you want to delete '+report+'?')) {
+ var pathName = window.location.pathname;
+ var pathArray = pathName.split("/");
+ var firstLevel = null;
+ if ( pathName.substr(0,1) == "/" )
+ firstLevel = "/" + pathArray[1];
+ else
+ firstLevel = "/" + pathArray[0];
+
+ $.ajax({
+ type: "POST",
+ url: firstLevel+"/report_manager/reports/deleteReport/"+report,
+ dataType: 'text',
+ success: function(reportList){
+ $('#ReportManagerSavedReportOptionContainer').html(reportList);
+ },
+ error: function(msg) {
+ $('#ReportManagerSavedReportOptionContainer').html('< Ajax Error >');
+ }
+ });
+ }
+ });
+
});

0 comments on commit a84f989

Please sign in to comment.