I want to enable footers for ng-grid but I want to completely customize it and override what ng-grid does by default.
Basically, I just want a 'Load more...' link at at the bottom of the grid that will load more rows from the server according to what pagingOptions.pageSize is set to and append it to the bottom of the grid while dynamically expanding the viewport height so there is no scrollbar.
Is there a configuration hook for this, or where/how can I do this?
Thanks.
Enabling Group Footers It is also possible to include a 'grand' total footer for all groups using the property groupIncludeTotalFooter . const gridOptions = { // adds subtotals groupIncludeFooter: true, // includes grand total groupIncludeTotalFooter: true, // other grid options ... }
1st step - Generate Pinned Total Row: Below function will generate an empty target object with all your columns available in the grid. 2nd step Calculate Total for some or all the columns: You need to calculate the total from row data and set the value in the above generated targeted row.
By default the grid allows deselection of rows. suppressRowClickSelection : If true , rows won't be selected when clicked. Use, for example, when you want checkbox selection, and don't want to also select the row when the row is clicked.
The easiest way to get a Row Node is by its Row ID. The ID is either provided by you using the grid callback getRowId() , or generated by the grid using an internal sequence.
Although it is not listed in the API section of the ng-grid website, you can define a custom $scope.gridOptions.footerTemplate
. Take a look a the source code and you will find (it is undefined, so it falls back to the default template as shown below):
// the template for the column menu and filter, including the button.
footerTemplate: undefined,
And here is the default template:
<div ng-show="showFooter" class="ngFooterPanel" ng-class="{'ui-widget-content': jqueryUITheme, 'ui-corner-bottom': jqueryUITheme}" ng-style="footerStyle()">
<div class="ngTotalSelectContainer" >
<div class="ngFooterTotalItems" ng-class="{'ngNoMultiSelect': !multiSelect}" >
<span class="ngLabel">{{i18n.ngTotalItemsLabel}} {{maxRows()}}</span><span ng-show="filterText.length > 0" class="ngLabel">({{i18n.ngShowingItemsLabel}} {{totalFilteredItemsLength()}})</span>
</div>
<div class="ngFooterSelectedItems" ng-show="multiSelect">
<span class="ngLabel">{{i18n.ngSelectedItemsLabel}} {{selectedItems.length}}</span>
</div>
</div>
<div class="ngPagerContainer" style="float: right; margin-top: 10px;" ng-show="enablePaging" ng-class="{'ngNoMultiSelect': !multiSelect}">
<div style="float:left; margin-right: 10px;" class="ngRowCountPicker">
<span style="float: left; margin-top: 3px;" class="ngLabel">{{i18n.ngPageSizeLabel}}</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="{{i18n.ngPagerFirstTitle}}"><div class="ngPagerFirstTriangle"><div class="ngPagerFirstBar"></div></div></button>
<button class="ngPagerButton" ng-click="pageBackward()" ng-disabled="cantPageBackward()" title="{{i18n.ngPagerPrevTitle}}"><div class="ngPagerFirstTriangle ngPagerPrevTriangle"></div></button>
<input class="ngPagerCurrent" min="1" max="{{maxPages()}}" type="number" style="width:50px; height: 24px; margin-top: 1px; padding: 0 4px;" ng-model="pagingOptions.currentPage"/>
<button class="ngPagerButton" ng-click="pageForward()" ng-disabled="cantPageForward()" title="{{i18n.ngPagerNextTitle}}"><div class="ngPagerLastTriangle ngPagerNextTriangle"></div></button>
<button class="ngPagerButton" ng-click="pageToLast()" ng-disabled="cantPageToLast()" title="{{i18n.ngPagerLastTitle}}"><div class="ngPagerLastTriangle"><div class="ngPagerLastBar"></div></div></button>
</div>
</div>
</div>
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