Default Headercell Template In Ng-grid
Consider the following snippet of angularJs code: var myHeaderCellTemplate = '
Copy
Controller:
@RequestMapping(value="/myHeaderCellTemplate", method=RequestMethod.GET)
public@ResponseBodyString headerTemplate() {
return"<div class=\"ngHeaderSortColumn {{col.headerClass}}\" ng-style=\"{cursor: col.cursor}\" ng-class=\"{ ngSorted: !noSortVisible }\">"+"<div class=\"ngHeaderText item\" id=\"{{col.displayName}}\" draggable value=\"{{col.displayName}}\">{{col.displayName}}</div>"+"<div class=\"ngSortButtonDown\" ng-show=\"col.showSortButtonDown()\"></div>"+"<div class=\"ngSortButtonUp\" ng-show=\"col.showSortButtonUp()\"></div>"+"<div class=\"ngSortPriority\">{{col.sortPriority}}</div>"+"</div>"+"<div ng-show=\"col.resizable\" class=\"ngHeaderGrip\" ng-click=\"col.gripClick($event)\" ng-mousedown=\"col.gripOnMouseDown($event)\"></div>";
}
App.js:
$scope.myData = excelAsJson.excelData;
$scope.colDefs = columnDefsJson.columnDefs;
$scope.gridOptions = { data: 'myData', columnDefs: 'colDefs'};
where $scope.colDefs
contains the output of generateHeaderCellTemplate()
List<String> excelFields
has all the column names groupped together
Post a Comment for "Default Headercell Template In Ng-grid"