PageSourceSearch

https://cdn.efleets.com/efm_shared/angular-ui-grid-extensions/1.0.…/javascript/directives/gridPrefsConfig.js

js efleets.com collected 2026-09-28 08:46:50 UTC 2,428 bytes, 58 lines download raw bytes

1angular.module('gridPrefsDirectives').directive('gridPrefsConfig',['GridPreferencesService','$timeout','uiGridConstants','$window', '$rootScope',function (GridPreferencesService,$timeout,uiGridConstants,$window,$rootScope) {
2	  return {
3		    restrict: 'A',
4		    priority: 0,
5		    link: function(scope, element, attrs) {	    
6		    	scope.columnOffset = 0;
7		    	scope.gridPrefsModel.gridPrefsConfigCompleted = false;
8
9		    	if (attrs && attrs.defaultHeightClass) {
10		    		scope.gridPrefsModel.gridHeight = attrs.defaultHeightClass;
11		    	} else {
12		    		scope.gridPrefsModel.gridHeight = "dashboardGrid";
13		    	}
14
15		    	if (scope.gridPrefsModel.gridOptions.multiSelect) {
16		    		scope.columnOffset = 1;
17		    	}
18		    	var isUpdateDynamicColumnsDirectiveUsed = scope.gridPrefsModel.updateDynamicColumnsFunction;
19 	    		
20		 		 scope.getUserGridPrefsSuccessFunction = function(data) {
21	 	    			GridPreferencesService.updateGridColumnDefs(data,scope.gridPrefsModel.gridOptions,(attrs.dynamicColumns == "true"),isUpdateDynamicColumnsDirectiveUsed,scope.gridPrefsModel);
22		 	    		
23	 	    			if (data.paginationPageSize > 0) {
24	 	    				scope.gridPrefsModel.gridOptions.paginationPageSize = data.paginationPageSize;
25	 	    			}
26		 	    		
27	 	    			if (data.gridHeight) {
28	 	    				var gridHeightSelection = GridPreferencesService.getGridHeightSelection(data.gridHeight);
29
30	 	    				if (data.gridHeight == 'medium' && (attrs && attrs.mediumHeightClass)) {
31	 	    					scope.gridPrefsModel.gridHeight = attrs.mediumHeightClass;
32	 	    				} else {
33	 	    					scope.gridPrefsModel.gridHeight = gridHeightSelection.cssClass;
34	 	    				}
35	 	 	 	 	 	 	
36	 	 	 	 	 	$rootScope.$broadcast('user-grid-height-found',{gridName:scope.gridPrefsModel.pageName, gridHeight:data.gridHeight});
37	 	 	 	 	 	 
38	 	    			}
39
40		 	    		$timeout(function(){
41	 	    				scope.gridPrefsModel.gridPrefsConfigCompleted = true;
42	 	    				},50);
43		 		 }
44		 		 
45	 	    	GridPreferencesService.getUserGridPrefs(scope.gridPrefsModel.pageName,(attrs.dynamicColumns == "true")).then(function(data) {
46	 	    		
47	 	    		if (isUpdateDynamicColumnsDirectiveUsed) {
48		 	    		$timeout(function(){
49		 	    			scope.getUserGridPrefsSuccessFunction(data);
50		 	    		},200);
51	 	    		} else {
52	 	    			scope.getUserGridPrefsSuccessFunction(data);
53	 	    		}
54 	    			
55	 	    	});		
56		    }
57	  }
58}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.