Skip to content
This repository has been archived by the owner on Dec 8, 2022. It is now read-only.

List view grid column change event #1897

Merged
merged 5 commits into from
Aug 15, 2018

Conversation

Blackbaud-TrevorBurch
Copy link
Member

Resolves #1092

…. Also fixed issue where grids were not emitting their event at the correct time.
@codecov-io
Copy link

codecov-io commented Aug 13, 2018

Codecov Report

Merging #1897 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master   #1897   +/-   ##
======================================
  Coverage     100%    100%           
======================================
  Files         414     414           
  Lines        8664    8678   +14     
  Branches     1282    1285    +3     
======================================
+ Hits         8664    8678   +14
Impacted Files Coverage Δ
src/modules/grid/grid.component.ts 100% <100%> (ø) ⬆️
...modules/list-view-grid/list-view-grid.component.ts 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 79d7288...5e16df0. Read the comment docs.

@blackbaud-johnly
Copy link
Contributor

Created #1906 to document new output property.

@Blackbaud-AlexKingman Blackbaud-AlexKingman self-assigned this Aug 15, 2018
.map((result: AsyncList<SkyGridColumnModel>) => {
/* istanbul ignore next */
/* sanity check */
return result.items.map((column: SkyGridColumnModel) => {
return column.id || column.field;
});
}).distinctUntilChanged();
}).distinctUntilChanged((previousValue: string[], newValue: string[]) => {
if (previousValue.length !== newValue.length) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To help with code readability, would you mind wrapping up this logic into a well named private method? Something like emitIfColumnsChanged() ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I went with a slightly different name as it compares along with emitting but the extraction is done.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. I like that a lot better! One suggestion - I'm still learning SKY UX conventions, but I don't see many instances of methods/properties prefixed with have. I wonder if something like columnIdsChanged would suffice?

@@ -139,6 +139,9 @@ export class SkyGridComponent implements AfterContentInit, OnChanges, OnDestroy
this.setDisplayedColumns(true);
} else if (changes['selectedColumnIds'] && this.columns) {
this.setDisplayedColumns();
if (changes['selectedColumnIds'].previousValue !== changes['selectedColumnIds'].currentValue) {
this.selectedColumnIdsChange.emit(this.selectedColumnIds);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This might emit twice if you're dragging a header (see line 228). Is there a way to ensure this only gets emitted once?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Spoke to Alex offline. This second emit only happens for the list view grid due to how it loads the grid. However, the list view grid handles this case so we should be good to go here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants