Resolved the Policy GUI Javascript issues
[policy/engine.git] / POLICY-SDK-APP / src / main / webapp / app / policyApp / controller / dictionaryGridController / MSModelDictGridController.js
index bbce9dd..007edd7 100644 (file)
@@ -46,19 +46,57 @@ app.controller('msModelsDictGridController', function ($scope, PolicyAppService,
     });
        
     $scope.msModelsDictionaryGrid = {
-        data : 'microServiceModelsDictionaryDatas',
-        enableFiltering: true,
-        columnDefs: [{
-            field: 'id', enableFiltering: false, headerCellTemplate: '' +
-            '<button id=\'New\' ng-click="grid.appScope.createNewMSModelsWindow()" class="btn btn-success">' + 'Create</button>',
-            cellTemplate:
-                '<button  type="button"  class="btn btn-danger"  ng-click="grid.appScope.deleteMSModels(row.entity)" ><i class="fa fa-trash-o"></i></button> ',  width: '8%'
-        },{ field: 'modelName', displayName : 'Micro Service Model', sort: { direction: 'asc', priority: 0 }},
-            { field: 'description' },
-            { field: 'version', displayName : 'Model Version' },
-            {field: 'userCreatedBy.userName', displayName : 'Imported By' }
-        ]
+            data : 'microServiceModelsDictionaryDatas',
+            enableFiltering: true,
+               exporterCsvFilename: 'MSPolicyDictionary.csv',
+               enableGridMenu: true,
+               enableSelectAll: true,
+            columnDefs: [{
+                field: 'id', 
+                enableFiltering: false, headerCellTemplate: '' +
+                '<button id=\'New\' ng-click="grid.appScope.createNewMSModelsWindow()" class="btn btn-success">' + 'Create</button>',
+                cellTemplate:
+                    '<button  type="button"  class="btn btn-danger"  ng-click="grid.appScope.deleteMSModels(row.entity)" ><i class="fa fa-trash-o"></i></button> ',  width: '8%'
+            },{ field: 'modelName', displayName : 'Micro Service Model', sort: { direction: 'asc', priority: 0 }},
+                { field: 'description' },
+                { field: 'version', displayName : 'Model Version' },
+                {field: 'userCreatedBy.userName', displayName : 'Imported By' },
+                {field: 'dependency', visible: false}, 
+                {field: 'attributes', visible: false},
+                {field: 'enumValues', visible: false},
+                {field: 'ref_attributes',visible: false},
+                {field: 'sub_attributes', visible: false}
+            ] ,
+               exporterMenuPdf: false,
+               exporterPdfDefaultStyle: {fontSize: 9},
+               exporterPdfTableStyle: {margin: [30, 30, 30, 30]},
+               exporterPdfTableHeaderStyle: {fontSize: 10, bold: true, italics: true, color: 'red'},
+               exporterPdfHeader: { text: "My Header", style: 'headerStyle' },
+               exporterPdfFooter: function ( currentPage, pageCount ) {
+                       return { text: currentPage.toString() + ' of ' + pageCount.toString(), style: 'footerStyle' };
+               },
+               exporterPdfCustomFormatter: function ( docDefinition ) {
+                       docDefinition.styles.headerStyle = { fontSize: 22, bold: true };
+                       docDefinition.styles.footerStyle = { fontSize: 10, bold: true };
+                       return docDefinition;
+               },
+               exporterFieldCallback: function(grid, row, col, input) {
+                if( col.name == 'createdDate' || col.name == 'modifiedDate') {
+                        var date = new Date(input);
+                        return date.toString("yyyy-MM-dd HH:MM:ss a");
+                } else {
+                        return input;
+                }
+               },
+               exporterPdfOrientation: 'portrait',
+               exporterPdfPageSize: 'LETTER',
+               exporterPdfMaxGridWidth: 500,
+               exporterCsvLinkElement: angular.element(document.querySelectorAll(".custom-csv-link-location")),
+               onRegisterApi: function(gridApi){
+                       $scope.gridApi = gridApi;
+               }
     };
+    
     $scope.editMSmodelName = null;
     $scope.createNewMSModelsWindow = function(){
         $scope.editMSmodelName = null;