Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions misc/tutorial/103_filtering.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ Refer {@link 321_singleFilter singleFilter tutorial}, it is possible to implemen
{ field: 'age', filters: [
{
condition: uiGridConstants.filter.GREATER_THAN,
placeholder: 'greater than',
term: 30
placeholder: 'greater than'
},
{
condition: uiGridConstants.filter.LESS_THAN,
Expand Down Expand Up @@ -206,14 +205,14 @@ Refer {@link 321_singleFilter singleFilter tutorial}, it is possible to implemen
width: 650px;
height: 400px;
}

.header-filtered {
color: blue;
}
</file>
<file name="scenario.js">
var gridTestUtils = require('../../test/e2e/gridTestUtils.spec.js');

describe('first grid on the page, filtered by male by default', function() {
it('grid should have seven visible columns', function () {
gridTestUtils.expectHeaderColumnCount( 'grid1', 7 );
Expand All @@ -232,15 +231,17 @@ Refer {@link 321_singleFilter singleFilter tutorial}, it is possible to implemen
it('third row should be Hatfield Hudson - will be Terry Clay if filtering broken', function () {
gridTestUtils.expectCellValueMatch( 'grid1', 2, 0, 'Hatfield Hudson' );
});

it('cancel filter on gender column, should now see Bishop Carr in third row', function() {
gridTestUtils.cancelFilterInColumn( 'grid1', 1 );

it('cancel filter on gender column and on date column, should now see Bishop Carr in third row', function() {
gridTestUtils.cancelFilterInColumn( 'grid1', 1 );
gridTestUtils.cancelFilterInColumn( 'grid1', 6 );
gridTestUtils.expectCellValueMatch( 'grid1', 2, 0, 'Bishop Carr' );
});

it('filter on email column, should automatically do "ends with"', function() {
gridTestUtils.cancelFilterInColumn( 'grid1', 1 );
gridTestUtils.enterFilterInColumn( 'grid1', 3, 'digirang.com' );
gridTestUtils.cancelFilterInColumn( 'grid1', 1 );
gridTestUtils.cancelFilterInColumn( 'grid1', 6 );
gridTestUtils.enterFilterInColumn( 'grid1', 3, 'digirang.com' );
gridTestUtils.expectRowCount( 'grid1', 2 );
});
});
Expand Down
2 changes: 1 addition & 1 deletion misc/tutorial/401_AllFeatures.ngdoc
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ All features are enabled to get an idea of performance
it('should not duplicate the menu options for pinning when resizing a column', function () {
element( by.id('refreshButton') ).click();
gridTestUtils.resizeHeaderCell( 'grid1', 1 );
gridTestUtils.expectVisibleColumnMenuItems( 'grid1', 1, 5);
gridTestUtils.expectVisibleColumnMenuItems( 'grid1', 1, 11);
});
});
</file>
Expand Down
4 changes: 2 additions & 2 deletions src/js/core/directives/ui-grid-menu-button.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ angular.module('ui.grid')
/**
* @ngdoc function
* @name addToGridMenu
* @propertyOf ui.grid.class:GridOptions
* @propertyOf ui.grid.gridMenuService
* @description add items to the grid menu. Used by features
* to add their menu items if they are enabled, can also be used by
* end users to add menu items. This method has the advantage of allowing
Expand Down Expand Up @@ -108,7 +108,7 @@ angular.module('ui.grid')
/**
* @ngdoc function
* @name removeFromGridMenu
* @methodOf ui.grid.core.api:PublicApi
* @methodOf ui.grid.gridMenuService
* @description Remove an item from the grid menu based on a provided id. Assumes
* that the id is unique, removes only the last instance of that id. Does nothing if
* the specified id is not found. If there is no gridMenuScope or registeredMenuItems
Expand Down
2 changes: 1 addition & 1 deletion src/templates/ui-grid/ui-grid-footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div class="ui-grid-footer-canvas">
<div class="ui-grid-footer-cell-wrapper" ng-style="colContainer.headerCellWrapperStyle()">
<div class="ui-grid-footer-cell-row">
<div ng-repeat="col in colContainer.renderedColumns track by col.colDef.name" ui-grid-footer-cell col="col" render-index="$index" class="ui-grid-footer-cell ui-grid-clearfix"></div>
<div ng-repeat="col in colContainer.renderedColumns track by col.uid" ui-grid-footer-cell col="col" render-index="$index" class="ui-grid-footer-cell ui-grid-clearfix"></div>
</div>
</div>
</div>
Expand Down
14 changes: 7 additions & 7 deletions test/e2e/gridTestUtils.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ module.exports = {
*
*/
expectHeaderColumnCount: function( gridId, expectedNumCols ) {
var headerCols = this.getGrid( gridId ).element( by.css('.ui-grid-render-container-body')).element( by.css('.ui-grid-header') ).all( by.repeater('col in colContainer.renderedColumns track by col.colDef.name') );
var headerCols = this.getGrid( gridId ).element( by.css('.ui-grid-render-container-body')).element( by.css('.ui-grid-header') ).all( by.repeater('col in colContainer.renderedColumns track by col.uid') );
expect(headerCols.count()).toEqual(expectedNumCols);
},

Expand All @@ -132,7 +132,7 @@ module.exports = {
*
*/
expectHeaderLeftColumnCount: function( gridId, expectedNumCols ) {
var headerCols = this.getGrid( gridId ).element( by.css('.ui-grid-render-container-left')).element( by.css('.ui-grid-header') ).all( by.repeater('col in colContainer.renderedColumns track by col.colDef.name') );
var headerCols = this.getGrid( gridId ).element( by.css('.ui-grid-render-container-left')).element( by.css('.ui-grid-header') ).all( by.repeater('col in colContainer.renderedColumns track by col.uid') );
expect(headerCols.count()).toEqual(expectedNumCols);
},

Expand All @@ -152,7 +152,7 @@ module.exports = {
*
*/
expectFooterColumnCount: function( gridId, expectedNumCols ) {
var footerCols = this.getGrid( gridId ).element( by.css('.ui-grid-footer') ).all( by.repeater('col in colContainer.renderedColumns track by col.colDef.name') );
var footerCols = this.getGrid( gridId ).element( by.css('.ui-grid-footer') ).all( by.repeater('col in colContainer.renderedColumns track by col.uid') );
expect(footerCols.count()).toEqual(expectedNumCols);
},

Expand All @@ -173,7 +173,7 @@ module.exports = {
*
*/
headerCell: function( gridId, expectedCol, expectedValue ) {
return this.getGrid( gridId ).element( by.css('.ui-grid-render-container-body')).element( by.css('.ui-grid-header') ).element( by.repeater('col in colContainer.renderedColumns track by col.colDef.name').row( expectedCol) );
return this.getGrid( gridId ).element( by.css('.ui-grid-render-container-body')).element( by.css('.ui-grid-header') ).element( by.repeater('col in colContainer.renderedColumns track by col.uid').row( expectedCol) );
},

/**
Expand All @@ -193,7 +193,7 @@ module.exports = {
*
*/
footerCell: function( gridId, expectedCol, expectedValue ) {
return this.getGrid( gridId ).element( by.css('.ui-grid-footer') ).element( by.repeater('col in colContainer.renderedColumns track by col.colDef.name').row( expectedCol) );
return this.getGrid( gridId ).element( by.css('.ui-grid-footer') ).element( by.repeater('col in colContainer.renderedColumns track by col.uid').row( expectedCol) );
},

/**
Expand All @@ -217,7 +217,7 @@ module.exports = {
*/
dataCell: function( gridId, fetchRow, fetchCol ) {
var row = this.getGrid( gridId ).element( by.css('.ui-grid-render-container-body')).element( by.repeater('(rowRenderIndex, row) in rowContainer.renderedRows track by $index').row( fetchRow ) );
return row.element( by.repeater('(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name').row( fetchCol ));
return row.element( by.repeater('(colRenderIndex, col) in colContainer.renderedColumns track by col.uid').row( fetchCol ));
},

/**
Expand Down Expand Up @@ -309,7 +309,7 @@ module.exports = {
var row = this.getRow( gridId, expectedRow );

for ( var i = 0; i < expectedValueArray.length; i++){
expect(row.element( by.repeater('(colRenderIndex, col) in colContainer.renderedColumns track by col.colDef.name').row(i)).getText()).toMatch(expectedValueArray[i], 'Expected to match: ' + expectedValueArray[i] + ' in column: ' + i);
expect(row.element( by.repeater('(colRenderIndex, col) in colContainer.renderedColumns track by col.uid').row(i)).getText()).toMatch(expectedValueArray[i], 'Expected to match: ' + expectedValueArray[i] + ' in column: ' + i);
}
},

Expand Down