Skip to content

Commit 20ca3ac

Browse files
committed
chore(tree-grid): address comments
1 parent fa9d5bb commit 20ca3ac

2 files changed

Lines changed: 28 additions & 19 deletions

File tree

samples/grids/tree-grid/data-searching/package.json

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,8 @@
1414
"lint": "eslint ./src/**/*.{ts,tsx}"
1515
},
1616
"dependencies": {
17-
"igniteui-dockmanager": "1.14.2",
18-
"igniteui-react": "18.6.0",
19-
"igniteui-react-core": "18.6.0",
20-
"igniteui-react-datasources": "18.6.0",
21-
"igniteui-react-grids": "18.6.0",
22-
"igniteui-react-inputs": "18.6.0",
23-
"igniteui-react-layouts": "18.6.0",
24-
"igniteui-webcomponents": "4.7.0",
17+
"igniteui-react": "18.6.1-alpha.0",
18+
"igniteui-react-grids": "18.6.1-alpha.0",
2519
"lit-html": "^2.2.0",
2620
"react": "^18.2.0",
2721
"react-dom": "^18.2.0",

samples/grids/tree-grid/data-searching/src/index.tsx

Lines changed: 26 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import {
2222
const mods: any[] = [IgrTreeGridModule, IgrChipModule, IgrIconButtonModule, IgrInputModule];
2323
mods.forEach((m) => m.register());
2424

25+
const searchIconText =
26+
"<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>";
2527
const prevIconText =
2628
"<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>";
2729
const nextIconText =
@@ -33,6 +35,7 @@ const data = new EmployeesFlatData();
3335

3436
export default function Sample() {
3537
const gridRef = useRef<IgrTreeGrid>(null);
38+
const searchIconRef = useRef<IgrIconButton>(null);
3639
const clearIconRef = useRef<IgrIconButton>(null);
3740
const iconButtonNextRef = useRef<IgrIconButton>(null);
3841
const iconButtonPrevRef = useRef<IgrIconButton>(null);
@@ -42,8 +45,9 @@ export default function Sample() {
4245
const [searchText, setSearchText] = useState('')
4346

4447
useEffect(() => {
45-
if (clearIconRef?.current) {
46-
clearIconRef.current.registerIconFromText("clear", clearIconText, "material");
48+
if (searchIconRef?.current) {
49+
searchIconRef.current.registerIconFromText("search", searchIconText, "material");
50+
searchIconRef.current.registerIconFromText("clear", clearIconText, "material");
4751
}
4852
if (iconButtonPrevRef?.current) {
4953
iconButtonPrevRef.current.registerIconFromText("prev", prevIconText,"material");
@@ -96,15 +100,26 @@ export default function Sample() {
96100
<IgrInput name="searchBox" value={searchText} inputOcurred={handleOnSearchChange}>
97101

98102
<div slot="prefix" key="prefix">
99-
<IgrIconButton
100-
key="clearIcon"
101-
ref={clearIconRef}
102-
variant="flat"
103-
name="clear"
104-
collection="material"
105-
clicked={clearSearch}
106-
></IgrIconButton>
103+
{searchText.length === 0 ? (
104+
<IgrIconButton
105+
key="searchIcon"
106+
ref={searchIconRef}
107+
variant="flat"
108+
name="search"
109+
collection="material"
110+
></IgrIconButton>
111+
) : (
112+
<IgrIconButton
113+
key="clearIcon"
114+
ref={clearIconRef}
115+
variant="flat"
116+
name="clear"
117+
collection="material"
118+
clicked={clearSearch}
119+
></IgrIconButton>
120+
)}
107121
</div>
122+
108123
<div slot="suffix" key="chipSuffix">
109124
<IgrChip ref={caseSensitiveChipRef} key="caseSensitiveChip" selectable="true" select={handleCaseSensitiveChange}>
110125
<span key="caseSensitive">Case Sensitive</span>
@@ -134,7 +149,7 @@ export default function Sample() {
134149
</IgrInput>
135150
</div>
136151
<IgrTreeGrid ref={gridRef} data={data} autoGenerate="false"
137-
primaryKey="ID" foreignKey="ParentID" allowFiltering="true" height="480px"
152+
primaryKey="ID" foreignKey="ParentID" allowFiltering="true" height="100%" width="100%"
138153
>
139154
<IgrColumn field="Name" dataType="string" sortable="true"></IgrColumn>
140155
<IgrColumn field="ID" dataType="number" sortable="true"></IgrColumn>

0 commit comments

Comments
 (0)