|
2 | 2 | * ng-grid JavaScript Library
|
3 | 3 | * Authors: https://github.com/angular-ui/ng-grid/blob/master/README.md
|
4 | 4 | * License: MIT (http://www.opensource.org/licenses/mit-license.php)
|
5 |
| -* Compiled At: 12/18/2012 19:00:19 |
| 5 | +* Compiled At: 12/20/2012 15:10:56 |
6 | 6 | ***********************************************/
|
7 | 7 |
|
8 | 8 | (function(window) {
|
@@ -62,9 +62,9 @@ ng.moveSelectionHandler = function($scope, grid, evt) {
|
62 | 62 | }
|
63 | 63 | grid.selectionService.ChangeSelection(items[index], evt);
|
64 | 64 | if (index > items.length - EXCESS_ROWS) {
|
65 |
| - grid.$viewport.scrollTop(grid.$viewport.scrollTop() + (grid.config.rowHeight * EXCESS_ROWS)); |
| 65 | + grid.$viewport.scrollTop(grid.$viewport.scrollTop() + (grid.config.rowHeight * 2)); |
66 | 66 | } else if (index < EXCESS_ROWS) {
|
67 |
| - grid.$viewport.scrollTop(grid.$viewport.scrollTop() - (grid.config.rowHeight * EXCESS_ROWS)); |
| 67 | + grid.$viewport.scrollTop(grid.$viewport.scrollTop() - (grid.config.rowHeight * 2)); |
68 | 68 | }
|
69 | 69 | if (!$scope.$$phase) {
|
70 | 70 | $scope.$digest();
|
@@ -545,9 +545,7 @@ ngGridServices.factory('DomUtilityService', function() {
|
545 | 545 | var trw = $scope.totalRowWidth();
|
546 | 546 | css = "." + gridId + " .ngCanvas { width: " + trw + "px; }" +
|
547 | 547 | "." + gridId + " .ngRow { width: " + trw + "px; }" +
|
548 |
| - "." + gridId + " .ngCell { height: " + rowHeight + "px; }" + |
549 | 548 | "." + gridId + " .ngCanvas { width: " + trw + "px; }" +
|
550 |
| - "." + gridId + " .ngHeaderCell { top: 0; bottom: 0; }" + |
551 | 549 | "." + gridId + " .ngHeaderScroller { width: " + (trw + domUtilityService.scrollH + 2) + "px}";
|
552 | 550 | angular.forEach(cols, function(col, i) {
|
553 | 551 | css += "." + gridId + " .col" + i + " { width: " + col.width + "px; left: " + sumWidth + "px; right: " + (trw - sumWidth - col.width) + "px; height: " + rowHeight + "px }" +
|
@@ -580,7 +578,7 @@ ngGridServices.factory('DomUtilityService', function() {
|
580 | 578 | /***********************************************
|
581 | 579 | * FILE: ..\src\templates\gridTemplate.html
|
582 | 580 | ***********************************************/
|
583 |
| -ng.defaultGridTemplate = function(){ return '<div class="ngTopPanel" ng-class="{\'ui-widget-header\':jqueryUITheme, \'ui-corner-top\': jqueryUITheme}" ng-style="topPanelStyle()"><div class="ngGroupPanel" ng-show="showGroupPanel()" ng-style="headerStyle()"><div class="ngGroupPanelDescription" ng-show="configGroups.length == 0">Drag a column header here and drop it to group by that column</div><ul ng-show="configGroups.length > 0" class="ngGroupList"><li class="ngGroupItem" ng-repeat="group in configGroups"><span class="ngGroupElement"><span class="ngGroupName">{{group.displayName}}<span ng-click="removeGroup($index)" class="ngRemoveGroup">x</span></span><span ng-hide="$last" class="ngGroupArrow"></span></span></li></ul></div><div class="ngHeaderContainer" ng-style="headerStyle()"><div class="ngHeaderScroller" ng-style="headerScrollerStyle()" ng-header-row></div></div><div class="ngHeaderButton" ng-show="showColumnMenu || showFilter" ng-click="toggleShowMenu()"><div class="ngHeaderButtonArrow" ng-click=""></div></div><div ng-show="showMenu" class="ngColMenu"><div ng-show="showFilter"><input placeholder="Search..." type="text" ng-model="filterText"/></div><div ng-show="showColumnMenu"><span class="ngMenuText">Choose Columns:</span><ul class="ngColList"><li class="ngColListItem" ng-repeat="col in columns | ngColumns"><label><input type="checkbox" class="ngColListCheckbox" ng-model="col.visible"/>{{col.displayName}}</label><a title="Group By" ng-class="col.groupedByClass()" ng-hide="col.field == \'\u2714\'" ng-click="groupBy(col)"></a><span class="ngGroupingNumber" ng-show="col.groupIndex > 0">{{col.groupIndex}}</span></li></ul></div></div></div><div class="ngViewport" ng-class="{\'ui-widget-content\': jqueryUITheme}" ng-style="viewportStyle()"><div class="ngCanvas" ng-style="canvasStyle()"><div ng-style="rowStyle(row)" ng-repeat="row in renderedRows" ng-click="row.toggleSelected($event)" class="ngRow" ng-class="{\'selected\': row.selected, \'ui-widget-content\': jqueryUITheme}" ng-class-odd="row.alternatingRowClass()" ng-class-even="row.alternatingRowClass()" ng-row></div></div></div><div class="ngFooterPanel" ng-class="{\'ui-widget-content\': jqueryUITheme, \'ui-corner-bottom\': jqueryUITheme}" ng-style="footerStyle()"><div class="ngTotalSelectContainer" ng-show="footerVisible"><div class="ngFooterTotalItems" ng-class="{\'ngNoMultiSelect\': !multiSelect}" ><span class="ngLabel">Total Items: {{maxRows}}</span><span ng-show="filterText.length > 0" class="ngLabel">(Showing Items: {{totalFilteredItemsLength()}})</span></div><div class="ngFooterSelectedItems" ng-show="multiSelect"><span class="ngLabel">Selected Items: {{selectedItems.length}}</span></div></div><div class="ngPagerContainer" style="float: right; margin-top: 10px;" ng-show="footerVisible && enablePaging" ng-class="{\'ngNoMultiSelect\': !multiSelect}"><div style="float:left; margin-right: 10px;" class="ngRowCountPicker"><span style="float: left; margin-top: 3px;" class="ngLabel">Page Size:</span><select style="float: left;height: 27px; width: 100px" ng-model="pagingOptions.pageSize" ><option ng-repeat="size in pagingOptions.pageSizes">{{size}}</option></select></div><div style="float:left; margin-right: 10px; line-height:25px;" class="ngPagerControl" style="float: left; min-width: 135px;"><button class="ngPagerButton" ng-click="pageToFirst()" ng-disabled="cantPageBackward()" title="First Page"><div class="ngPagerFirstTriangle"><div class="ngPagerFirstBar"></div></div></button><button class="ngPagerButton" ng-click="pageBackward()" ng-disabled="cantPageBackward()" title="Previous Page"><div class="ngPagerFirstTriangle ngPagerPrevTriangle"></div></button><input class="ngPagerCurrent" type="text" style="width:50px; height: 24px; margin-top: 1px; padding: 0px 4px;" ng-model="pagingOptions.currentPage"/><button class="ngPagerButton" ng-click="pageForward()" ng-disabled="cantPageForward()" title="Next Page"><div class="ngPagerLastTriangle ngPagerNextTriangle"></div></button><button class="ngPagerButton" ng-click="pageToLast()" ng-disabled="cantPageForward()" title="Last Page"><div class="ngPagerLastTriangle"><div class="ngPagerLastBar"></div></div></button></div></div></div>';}; |
| 581 | +ng.defaultGridTemplate = function(){ return '<div class="ngTopPanel" ng-class="{\'ui-widget-header\':jqueryUITheme, \'ui-corner-top\': jqueryUITheme}" ng-style="topPanelStyle()"><div class="ngGroupPanel" ng-show="showGroupPanel()" ng-style="headerStyle()"><div class="ngGroupPanelDescription" ng-show="configGroups.length == 0">Drag a column header here and drop it to group by that column</div><ul ng-show="configGroups.length > 0" class="ngGroupList"><li class="ngGroupItem" ng-repeat="group in configGroups"><span class="ngGroupElement"><span class="ngGroupName">{{group.displayName}}<span ng-click="removeGroup($index)" class="ngRemoveGroup">x</span></span><span ng-hide="$last" class="ngGroupArrow"></span></span></li></ul></div><div class="ngHeaderContainer" ng-style="headerStyle()"><div class="ngHeaderScroller" ng-style="headerScrollerStyle()" ng-header-row></div></div><div class="ngHeaderButton" ng-show="showColumnMenu || showFilter" ng-click="toggleShowMenu()"><div class="ngHeaderButtonArrow" ng-click=""></div></div><div ng-show="showMenu" class="ngColMenu"><div ng-show="showFilter"><input placeholder="Search..." type="text" ng-model="filterText"/></div><div ng-show="showColumnMenu"><span class="ngMenuText">Choose Columns:</span><ul class="ngColList"><li class="ngColListItem" ng-repeat="col in columns | ngColumns"><label><input type="checkbox" class="ngColListCheckbox" ng-model="col.visible"/>{{col.displayName}}</label><a title="Group By" ng-class="col.groupedByClass()" ng-show="col.groupable" ng-click="groupBy(col)"></a><span class="ngGroupingNumber" ng-show="col.groupIndex > 0">{{col.groupIndex}}</span></li></ul></div></div></div><div class="ngViewport" ng-class="{\'ui-widget-content\': jqueryUITheme}" ng-style="viewportStyle()"><div class="ngCanvas" ng-style="canvasStyle()"><div ng-style="rowStyle(row)" ng-repeat="row in renderedRows" ng-click="row.toggleSelected($event)" class="ngRow" ng-class="row.alternatingRowClass()" ng-row></div></div></div><div class="ngFooterPanel" ng-class="{\'ui-widget-content\': jqueryUITheme, \'ui-corner-bottom\': jqueryUITheme}" ng-style="footerStyle()"><div class="ngTotalSelectContainer" ng-show="footerVisible"><div class="ngFooterTotalItems" ng-class="{\'ngNoMultiSelect\': !multiSelect}" ><span class="ngLabel">Total Items: {{maxRows}}</span><span ng-show="filterText.length > 0" class="ngLabel">(Showing Items: {{totalFilteredItemsLength()}})</span></div><div class="ngFooterSelectedItems" ng-show="multiSelect"><span class="ngLabel">Selected Items: {{selectedItems.length}}</span></div></div><div class="ngPagerContainer" style="float: right; margin-top: 10px;" ng-show="footerVisible && enablePaging" ng-class="{\'ngNoMultiSelect\': !multiSelect}"><div style="float:left; margin-right: 10px;" class="ngRowCountPicker"><span style="float: left; margin-top: 3px;" class="ngLabel">Page Size:</span><select style="float: left;height: 27px; width: 100px" ng-model="pagingOptions.pageSize" ><option ng-repeat="size in pagingOptions.pageSizes">{{size}}</option></select></div><div style="float:left; margin-right: 10px; line-height:25px;" class="ngPagerControl" style="float: left; min-width: 135px;"><button class="ngPagerButton" ng-click="pageToFirst()" ng-disabled="cantPageBackward()" title="First Page"><div class="ngPagerFirstTriangle"><div class="ngPagerFirstBar"></div></div></button><button class="ngPagerButton" ng-click="pageBackward()" ng-disabled="cantPageBackward()" title="Previous Page"><div class="ngPagerFirstTriangle ngPagerPrevTriangle"></div></button><input class="ngPagerCurrent" type="text" style="width:50px; height: 24px; margin-top: 1px; padding: 0px 4px;" ng-model="pagingOptions.currentPage"/><button class="ngPagerButton" ng-click="pageForward()" ng-disabled="cantPageForward()" title="Next Page"><div class="ngPagerLastTriangle ngPagerNextTriangle"></div></button><button class="ngPagerButton" ng-click="pageToLast()" ng-disabled="cantPageForward()" title="Last Page"><div class="ngPagerLastTriangle"><div class="ngPagerLastBar"></div></div></button></div></div></div>';}; |
584 | 582 |
|
585 | 583 | /***********************************************
|
586 | 584 | * FILE: ..\src\templates\rowTemplate.html
|
@@ -929,6 +927,7 @@ ng.Column = function(config, $scope, grid, domUtilityService) {
|
929 | 927 | self.visible = ng.utils.isNullOrUndefined(colDef.visible) || colDef.visible;
|
930 | 928 | self.sortable = false;
|
931 | 929 | self.resizable = false;
|
| 930 | + self.groupable = ng.utils.isNullOrUndefined(colDef.groupable) || colDef.sortable; |
932 | 931 | if (config.enableSort) {
|
933 | 932 | self.sortable = ng.utils.isNullOrUndefined(colDef.sortable) || colDef.sortable;
|
934 | 933 | }
|
@@ -1526,6 +1525,7 @@ ng.Grid = function($scope, options, sortService, domUtilityService, $filter) {
|
1526 | 1525 | width: self.elementDims.rowSelectedCellW,
|
1527 | 1526 | sortable: false,
|
1528 | 1527 | resizable: false,
|
| 1528 | + groupable: false, |
1529 | 1529 | headerCellTemplate: '<input class="ngSelectionHeader" type="checkbox" ng-show="multiSelect" ng-model="allSelected" ng-change="toggleSelectAll(allSelected)"/>',
|
1530 | 1530 | cellTemplate: '<div class="ngSelectionCell"><input class="ngSelectionCheckbox" type="checkbox" ng-checked="row.selected" /></div>'
|
1531 | 1531 | },
|
@@ -1809,7 +1809,7 @@ ng.Grid = function($scope, options, sortService, domUtilityService, $filter) {
|
1809 | 1809 | return Math.max(0, self.rootDim.outerHeight - $scope.topPanelHeight() - $scope.footerRowHeight - 2);
|
1810 | 1810 | };
|
1811 | 1811 | $scope.groupBy = function(col) {
|
1812 |
| - if (self.sortedData.length < 1) { |
| 1812 | + if (self.sortedData.length < 1 || !col.groupable) { |
1813 | 1813 | return;
|
1814 | 1814 | }
|
1815 | 1815 | var indx = $scope.configGroups.indexOf(col);
|
@@ -1910,11 +1910,16 @@ ng.Row = function(entity, config, selectionService) {
|
1910 | 1910 | self.rowIndex = 0;
|
1911 | 1911 | self.offsetTop = 0;
|
1912 | 1912 | self.rowDisplayIndex = 0;
|
1913 |
| - self.alternatingRowClass = function() { |
1914 |
| - if ((self.rowIndex % 2) === 0) { |
1915 |
| - return self.jqueryUITheme ? "ui-state-active even" : "even"; |
1916 |
| - } |
1917 |
| - return self.jqueryUITheme ? "ui-state-default odd" : "odd"; |
| 1913 | + self.alternatingRowClass = function () { |
| 1914 | + var isEven = (self.rowIndex % 2) === 0; |
| 1915 | + var classes = { |
| 1916 | + 'selected': self.selected, |
| 1917 | + 'ui-state-default': self.jqueryUITheme && isEven, |
| 1918 | + 'ui-state-active': self.jqueryUITheme && !isEven, |
| 1919 | + 'even': isEven, |
| 1920 | + 'odd': !isEven |
| 1921 | + }; |
| 1922 | + return classes; |
1918 | 1923 | };
|
1919 | 1924 | self.beforeSelectionChange = config.beforeSelectionChangeCallback;
|
1920 | 1925 | self.afterSelectionChange = config.afterSelectionChangeCallback;
|
|
0 commit comments