I’ve successfully added several custom templates to ui-grid in the past. Header template, cell template, header cell template have been no problem.
However I’ve been trying to add a custom viewport template to ui-grid with no success.
I tried adding the template:
I’ve also searched for issues covering this with no success.
Here’s a custom header template successfully added:
https://plnkr.co/edit/Vh4uEX5Gksk0kHkVV7Yk?p=preview
Then here’s a custom viewport template failing to load using the same method:
https://plnkr.co/edit/50dmzHwdhZNWj0tzR7ux?p=preview
I’m using ui-grid 3.1.1
// Replace default ui-grid template
const oldTemplate = $templateCache.get('ui-grid/uiGridViewport');
$templateCache.remove('ui-grid/uiGridViewport');
$templateCache.put('ui-grid/uiGridViewport', 'YOUR CUSTOM TEMPLATE GOES HERE');
$scope.$on('$destroy', () => {
// Restore default ui-grid template
$templateCache.remove('ui-grid/uiGridViewport');
$templateCache.put('ui-grid/uiGridViewport', oldTemplate);
});