Angular UI-Grid has a property called footerTemplate, which is supposed to offer the possibility to create a custom footer template. I tried entering html content (a div with some text) in a string, I've also tried adding a .html file name in the string and even the ID of a rendered div, but none of them seem to work. It also wasn't clear for me if I need to enable showGridFooter for this or not, so I tried both, but the footerTemplate is either not shown at all, or if I set showGridFooter to true, it shows the default footer (total lines in the grid). What am I missing here?
For angular-ui-grid 3.0.x it's working with the following example options:
$scope.options = {
showGridFooter: true,
gridFooterTemplate: '<div>pink floyd</div>'
};
For the 2.x ng-grid versions, Mokgra's version is good.
Try enclosing the footer template inside div tag like
$scope.gridOptions = {
showGridFooter: true,
gridFooterTemplate: "<div>Message Here</div>"
}
if you want to show any scope variable
$scope.SomeScopeVariable = "Message Here";
$scope.gridOptions = {
showGridFooter: true,
gridFooterTemplate: "<div>Grid Footer: {{grid.appScope.SomeScopeVariable}}</div>"
}
grid.appScope allows access to scope variables in templates. tested with angular-ui-grid 3.0.x
I updated my version of ui-grid to the "pre-beta" 3.x and now I'm at the same point you are. Using 'showGridFooter' set to true will show total rows info automatically. Specifying a 'footerTemplate' doesn't do anything. I've tried with both 'showGridFooter' and 'showFooter' present and absent. So the following paragraph of my answer only works for the 2.x "stable" version of ui-grid.
Wierdly, showFooter property needed set to true. What worked for me is to add an html file to my project that contained a div full of goodies (like you were thinking). Seems like a bug. showGridFooter property didn't work for me.
$scope.gridOptions1 = {
showFooter: true,
footerTemplate:'somePath/footerTemplate.html'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With