commonModule.controller('cellDetailPanelController', ['$log', '$scope', '$translate', function ($log, $scope, $translate) { var hidePanel = function () { $('#cellDetailPanel').hide('normal'); }; var lastHeight = -1; var togglePanel = function () { $('#cellDetailConent').toggle('normal'); $scope.isExpand = !$scope.isExpand; if ($scope.isExpand) { if (lastHeight === -1) lastHeight = '650px'; $('#cellDetailPanel').css({ 'min-height': '650px', 'height': lastHeight }); } else { lastHeight = $('#cellDetailPanel').css('height'); $('#cellDetailPanel').css({ 'min-height': '0px', 'height': '0px' }); } }; var initGrid = function () { $scope.gridOptions = { bindingOptions: { dataSource: 'detail.dataSources', columns: 'columnsOptions', height:'height' }, showColumnLines: false, showBorders: true, showColumnHeaders: true, showRowLines: false, width: '100%', noDataText: '', paging: { enabled: false }, summary: { totalItems: [ //{ // column: 'id', // customizeText: function (data) { // return $translate.instant('Subtotal'); // } //}, { column: "amount", customizeText: function (data) { var message = $translate.instant('Subtotal') + ' '; if ($scope.detail.cellValue != null && $scope.detail.cellValue!=undefined) { message += Number($scope.detail.cellValue).formatAmount(); } return message; } } ] } }; }; $scope.$watch('sourceType', function (newData, oldData) { if (newData !== oldData) { if ($scope.sourceType === -1) { $scope.columnsOptions = [ { dataField: 'id', caption: $translate.instant('SequenceNo'), width: '20%', alignment: 'left' }, { dataField: 'rowName', caption: $translate.instant('Project'), width: '40%' }, { dataField: 'columnName', caption: $translate.instant('TaxReportColumn'), width: '40%' }, { dataField: 'cellPosition', caption: $translate.instant('CellColumn'), width: '40%' }, { dataField: 'amount', caption: $translate.instant('Amount'), width: '42%', format: { type: 'fixedPoint', precision: 2 } } ]; } else { $scope.columnsOptions = [ { dataField: 'id', caption: $translate.instant('SequenceNo'), width: '18%', alignment: 'left' }, { dataField: 'name', caption: $translate.instant('CITProject'), width: '50%' }, { dataField: 'amount', caption: $translate.instant('Amount'), width: '42%', format: { type: 'fixedPoint', precision: 2 } } ]; } } }); (function () { $scope.hidePanel = hidePanel; $scope.isExpand = true; $scope.togglePanel = togglePanel; initGrid(); })(); }]);