Skip to content

Commit 872b6f9

Browse files
Merge branch 'vnext' into rivanova/banner-samples
2 parents 23e8b83 + 8fb32c2 commit 872b6f9

File tree

2 files changed

+18
-13
lines changed

2 files changed

+18
-13
lines changed

samples/grids/grid/data-searching/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<div class="container vertical">
2121
<div style="margin-bottom: 1rem">
2222
<igc-input id="searchBox" name="searchBox">
23-
<igc-icon id="clearIcon" slot="prefix" name="clear" collection="material"></igc-icon>
23+
<igc-icon id="searchIcon" slot="prefix" name="search" collection="material"></igc-icon>
2424
<div slot="suffix">
2525
<igc-chip selectable="true" id="caseSensitiveChip">Case Sensitive</igc-chip>
2626
<igc-chip selectable="true" id="exactMatchChip">Exact Match</igc-chip>
@@ -32,7 +32,7 @@
3232
</igc-input>
3333
</div>
3434

35-
<igc-grid auto-generate="false" id="grid" name="grid" allow-filtering="true" display-density="compact">
35+
<igc-grid auto-generate="false" id="grid" name="grid" allow-filtering="true" display-density="compact" height="100%" width="100%">
3636
<igc-column field="IndustrySector" data-type="string" sortable="true"></igc-column>
3737
<igc-column field="IndustryGroup" data-type="string" sortable="true"></igc-column>
3838
<igc-column field="SectorType" data-type="string" sortable="true"></igc-column>

samples/grids/grid/data-searching/src/index.ts

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,44 @@ import 'igniteui-webcomponents/themes/light/bootstrap.css';
33
import "igniteui-webcomponents-grids/grids/themes/light/bootstrap.css";
44

55
import { IgcGridComponent } from 'igniteui-webcomponents-grids/grids';
6-
import { defineComponents, IgcInputComponent, IgcChipComponent, IgcIconComponent, IgcIconButtonComponent, registerIconFromText } from 'igniteui-webcomponents';
6+
import { defineComponents, IgcInputComponent, IgcChipComponent, IgcIconComponent, IgcIconButtonComponent, registerIconFromText } from 'igniteui-webcomponents';
77
import { MarketData } from './MarketData';
88

99
defineComponents(IgcInputComponent, IgcChipComponent, IgcIconComponent, IgcIconButtonComponent);
1010

1111
export class Sample {
1212

1313
private grid: IgcGridComponent;
14-
1514
private searchBox: IgcInputComponent;
16-
15+
private searchIcon: IgcIconComponent;
1716
private clearIcon: IgcIconComponent;
1817
private nextIconButton: IgcIconButtonComponent;
1918
private prevIconButton: IgcIconButtonComponent;
20-
2119
private caseSensitiveChip: IgcChipComponent;
2220
private exactMatchChip: IgcChipComponent;
23-
2421
private data: MarketData;
25-
2622
private _bind: () => void;
2723

2824
constructor() {
2925
var grid = this.grid = document.getElementById('grid') as IgcGridComponent;
30-
26+
3127
this.nextSearch = this.nextSearch.bind(this);
3228
this.prevSearch = this.prevSearch.bind(this);
3329
this.clearSearch = this.clearSearch.bind(this);
30+
3431

3532
const prevIconText = "<svg width='24' height='24' viewBox='0 0 24 24'><path d='M15.41 7.41 14 6l-6 6 6 6 1.41-1.41L10.83 12z'></path></svg>";
3633
const nextIconText = "<svg width='24' height='24' viewBox='0 0 24 24'><path d='M10 6 8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z'></path></svg>";
3734
const clearIconText = "<svg width='24' height='24' viewBox='0 0 24 24' title='Clear'><path d='M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z'></path></svg>";
38-
35+
const searchIconText = "<svg width='24' height='24' viewBox='0 0 24 24'><path d='M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z' /></svg>";
36+
3937
registerIconFromText("prev", prevIconText, "material");
4038
registerIconFromText("next", nextIconText, "material");
4139
registerIconFromText("clear", clearIconText, "material");
40+
registerIconFromText("search", searchIconText, "material");
41+
42+
var searchIcon = this.searchIcon = document.getElementById('searchIcon') as IgcIconComponent;
4243

43-
var clearIcon = this.clearIcon = document.getElementById('clearIcon') as IgcIconComponent;
4444

4545
var nextIconButton = this.nextIconButton = document.getElementById('nextIconBtn') as IgcIconButtonComponent;
4646
var prevIconButton = this.prevIconButton = document.getElementById('prevIconBtn') as IgcIconButtonComponent;
@@ -56,9 +56,13 @@ export class Sample {
5656
grid.data = this.data;
5757

5858
searchBox.addEventListener("keydown", (evt) => { this.onSearchKeydown(evt); });
59+
this.searchBox.addEventListener("igcInput", (evt) => {
60+
this.searchIcon.name = evt.detail ? 'clear' : 'search';
61+
this.grid.findNext(evt.detail, this.caseSensitiveChip.selected, this.exactMatchChip.selected);
62+
});
5963
nextIconButton.addEventListener("click", this.nextSearch);
6064
prevIconButton.addEventListener("click", this.prevSearch);
61-
clearIcon.addEventListener("click", this.clearSearch);
65+
searchIcon.addEventListener("click", this.clearSearch);
6266
}
6367
this._bind();
6468
}
@@ -83,7 +87,8 @@ export class Sample {
8387

8488
public clearSearch() {
8589
this.searchBox.value = "";
86-
this.grid.clearSearch();
90+
this.grid.clearSearch();
91+
this.searchIcon.name = 'search';
8792
}
8893
}
8994

0 commit comments

Comments
 (0)