Skip to content

Commit

Permalink
Merge pull request #503 from christianacca/master
Browse files Browse the repository at this point in the history
docs(examples): disabled/hidden filter and nested grid examples
  • Loading branch information
Github committed Jan 15, 2015
2 parents a76fc98 + bb646dd commit 4e6bda3
Show file tree
Hide file tree
Showing 5 changed files with 220 additions and 7 deletions.
13 changes: 8 additions & 5 deletions dist/ng-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ app.factory('ngTableParams', ['$q', '$log', function ($q, $log) {
* @returns {Array} Return true if field sorted by direction
*/
this.isSortBy = function (field, direction) {
return angular.isDefined(params.sorting[field]) && params.sorting[field] == direction;
return angular.isDefined(params.sorting[field]) && angular.equals(params.sorting[field], direction);
};

/**
Expand Down Expand Up @@ -310,7 +310,8 @@ app.factory('ngTableParams', ['$q', '$log', function ($q, $log) {
pages.push({
type: 'first',
number: 1,
active: currentPage > 1
active: currentPage > 1,
current: currentPage === 1
});
maxPivotPages = Math.round((maxBlocks - 5) / 2);
minPage = Math.max(2, currentPage - maxPivotPages);
Expand All @@ -327,15 +328,17 @@ app.factory('ngTableParams', ['$q', '$log', function ($q, $log) {
pages.push({
type: 'page',
number: i,
active: currentPage !== i
active: currentPage !== i,
current: currentPage === i
});
}
i++;
}
pages.push({
type: 'last',
number: numPages,
active: currentPage !== numPages
active: currentPage !== numPages,
current: currentPage === numPages
});
pages.push({
type: 'next',
Expand Down Expand Up @@ -730,7 +733,7 @@ angular.module('ngTable').run(['$templateCache', function ($templateCache) {
$templateCache.put('ng-table/filters/select.html', '<select ng-options="data.id as data.title for data in column.data" ng-disabled="$filterRow.disabled" ng-model="params.filter()[name]" ng-show="filter==\'select\'" class="filter filter-select form-control" name="{{column.filterName}}"> </select>');
$templateCache.put('ng-table/filters/text.html', '<input type="text" name="{{column.filterName}}" ng-disabled="$filterRow.disabled" ng-model="params.filter()[name]" ng-if="filter==\'text\'" class="input-filter form-control"/>');
$templateCache.put('ng-table/header.html', '<tr> <th ng-repeat="column in $columns" ng-class="{ \'sortable\': parse(column.sortable), \'sort-asc\': params.sorting()[parse(column.sortable)]==\'asc\', \'sort-desc\': params.sorting()[parse(column.sortable)]==\'desc\' }" ng-click="sortBy(column, $event)" ng-show="column.show(this)" ng-init="template=column.headerTemplateURL(this)" class="header {{column.class}}"> <div ng-if="!template" ng-show="!template" ng-bind="parse(column.title)"></div> <div ng-if="template" ng-show="template" ng-include="template"></div> </th> </tr> <tr ng-show="show_filter" class="ng-table-filters"> <th ng-repeat="column in $columns" ng-show="column.show(this)" class="filter"> <div ng-repeat="(name, filter) in column.filter"> <div ng-if="column.filterTemplateURL" ng-show="column.filterTemplateURL"> <div ng-include="column.filterTemplateURL"></div> </div> <div ng-if="!column.filterTemplateURL" ng-show="!column.filterTemplateURL"> <div ng-include="\'ng-table/filters/\' + filter + \'.html\'"></div> </div> </div> </th> </tr> ');
$templateCache.put('ng-table/pager.html', '<div class="ng-cloak ng-table-pager"> <div ng-if="params.settings().counts.length" class="ng-table-counts btn-group pull-right"> <button ng-repeat="count in params.settings().counts" type="button" ng-class="{\'active\':params.count()==count}" ng-click="params.count(count)" class="btn btn-default"> <span ng-bind="count"></span> </button> </div> <ul class="pagination ng-table-pagination"> <li ng-class="{\'disabled\': !page.active}" ng-repeat="page in pages" ng-switch="page.type"> <a ng-switch-when="prev" ng-click="params.page(page.number)" href="">&laquo;</a> <a ng-switch-when="first" ng-click="params.page(page.number)" href=""><span ng-bind="page.number"></span></a> <a ng-switch-when="page" ng-click="params.page(page.number)" href=""><span ng-bind="page.number"></span></a> <a ng-switch-when="more" ng-click="params.page(page.number)" href="">&#8230;</a> <a ng-switch-when="last" ng-click="params.page(page.number)" href=""><span ng-bind="page.number"></span></a> <a ng-switch-when="next" ng-click="params.page(page.number)" href="">&raquo;</a> </li> </ul> </div> ');
$templateCache.put('ng-table/pager.html', '<div class="ng-cloak ng-table-pager"> <div ng-if="params.settings().counts.length" class="ng-table-counts btn-group pull-right"> <button ng-repeat="count in params.settings().counts" type="button" ng-class="{\'active\':params.count()==count}" ng-click="params.count(count)" class="btn btn-default"> <span ng-bind="count"></span> </button> </div> <ul class="pagination ng-table-pagination"> <li ng-class="{\'disabled\': !page.active && !page.current, \'active\': page.current}" ng-repeat="page in pages" ng-switch="page.type"> <a ng-switch-when="prev" ng-click="params.page(page.number)" href="">&laquo;</a> <a ng-switch-when="first" ng-click="params.page(page.number)" href=""><span ng-bind="page.number"></span></a> <a ng-switch-when="page" ng-click="params.page(page.number)" href=""><span ng-bind="page.number"></span></a> <a ng-switch-when="more" ng-click="params.page(page.number)" href="">&#8230;</a> <a ng-switch-when="last" ng-click="params.page(page.number)" href=""><span ng-bind="page.number"></span></a> <a ng-switch-when="next" ng-click="params.page(page.number)" href="">&raquo;</a> </li> </ul> </div> ');
}]);
return app;
}));
Loading

0 comments on commit 4e6bda3

Please sign in to comment.