-
Notifications
You must be signed in to change notification settings - Fork 22
refactor(grids): cleanup search snippets #5851
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -165,17 +165,17 @@ The methods from above return a **number** value (the number of times the @@igCo | |
|
|
||
| Let's also display the position of the current occurrence, along with the total results count! We can do this by using the grid's `lastSearchInfo` property. This property is automatically updated when using the **find** methods. | ||
|
|
||
| - The `@@igObjectRef.lastSearchInfo.matchInfoCache.length` value will give us the total results count. | ||
| - The `@@igObjectRef.lastSearchInfo.matchCount` value will give us the total results count. | ||
| - The `@@igObjectRef.lastSearchInfo.activeMatchIndex` value will give us the index position of the current occurrence (match). | ||
|
|
||
| ```html | ||
| <!--searchgrid.component.html--> | ||
|
|
||
| <div class="resultsText" *ngIf="@@igObjectRef.lastSearchInfo"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length > 0"> | ||
| {{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchInfoCache.length }} results | ||
| <div class="resultsText"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchCount > 0"> | ||
| {{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchCount }} results | ||
| </span> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length == 0"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchCount == 0"> | ||
| No results | ||
| </span> | ||
| </div> | ||
|
|
@@ -322,11 +322,11 @@ On the right in our input group, let's create three separate containers with the | |
| <!--searchgrid.component.html--> | ||
|
|
||
| <igx-suffix *ngIf="searchText.length > 0"> | ||
| <div class="resultsText" *ngIf="@@igObjectRef.lastSearchInfo"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length > 0"> | ||
| {{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchInfoCache.length }} results | ||
| <div class="resultsText"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchCount > 0"> | ||
| {{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchCount }} results | ||
| </span> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length == 0"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchCount == 0"> | ||
| No results | ||
|
Comment on lines
324
to
330
|
||
| </span> | ||
| </div> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -161,17 +161,17 @@ public exactMatch: boolean = false; | |
|
|
||
| 検索で見つかった現在の場所と総個数を示します。グリッドの `lastSearchInfo` プロパティを使用します。このプロパティは、**find** メソッド使用時に自動的に更新されます。 | ||
|
|
||
| - `@@igObjectRef.lastSearchInfo.matchInfoCache.length` 値は検索で見つかった個数です。 | ||
| - `@@igObjectRef.lastSearchInfo.matchCount` 値は検索で見つかった個数です。 | ||
| - `@@igObjectRef.lastSearchInfo.activeMatchIndex` 値は、現在の一致 (出現) のインデックス位置です。 | ||
|
|
||
| ```html | ||
| <!--searchgrid.component.html--> | ||
|
|
||
| <div class="resultsText" *ngIf="@@igObjectRef.lastSearchInfo"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length > 0"> | ||
| {{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchInfoCache.length }} results | ||
| <div class="resultsText"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchCount > 0"> | ||
| {{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchCount }} results | ||
| </span> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length == 0"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchCount == 0"> | ||
|
Comment on lines
+170
to
+174
|
||
| No results | ||
| </span> | ||
| </div> | ||
|
|
@@ -317,11 +317,11 @@ public clearSearch() { | |
| <!--searchgrid.component.html--> | ||
|
|
||
| <igx-suffix *ngIf="searchText.length > 0"> | ||
| <div class="resultsText" *ngIf="@@igObjectRef.lastSearchInfo"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length > 0"> | ||
| {{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchInfoCache.length }} results | ||
| <div class="resultsText"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchCount > 0"> | ||
| {{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchCount }} results | ||
| </span> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length == 0"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchCount == 0"> | ||
| No results | ||
|
Comment on lines
319
to
325
|
||
| </span> | ||
| </div> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -145,17 +145,17 @@ public exactMatch: boolean = false; | |
| #### 결과 수 표시 | ||
| 총 결과 수와 함께 현재 검색 위치를 표시합니다! 그리드의 `lastSearchInfo` 속성을 사용하여 이것을 실행할 수 있습니다. 이 속성은 **find** 메소드를 사용할 때 자동으로 업데이트됩니다. | ||
|
|
||
| - `@@igObjectRef.lastSearchInfo.matchInfoCache.length` 값은 총 결과 수입니다. | ||
| - `@@igObjectRef.lastSearchInfo.matchCount` 값은 총 결과 수입니다. | ||
| - `@@igObjectRef.lastSearchInfo.activeMatchIndex` 값은 현재 검색(일치)의 인덱스 위치입니다. | ||
|
|
||
| ```html | ||
| <!--searchgrid.component.html--> | ||
|
|
||
| <div class="resultsText" *ngIf="@@igObjectRef.lastSearchInfo"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length > 0"> | ||
| {{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchInfoCache.length }} results | ||
| <div class="resultsText"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchCount > 0"> | ||
| {{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchCount }} results | ||
| </span> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length == 0"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchCount == 0"> | ||
|
Comment on lines
+154
to
+158
|
||
| No results | ||
| </span> | ||
| </div> | ||
|
|
@@ -294,11 +294,11 @@ public clearSearch() { | |
| <!--searchgrid.component.html--> | ||
|
|
||
| <igx-suffix *ngIf="searchText.length > 0"> | ||
| <div class="resultsText" *ngIf="@@igObjectRef.lastSearchInfo"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length > 0"> | ||
| {{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchInfoCache.length }} results | ||
| <div class="resultsText"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchCount > 0"> | ||
| {{ @@igObjectRef.lastSearchInfo.activeMatchIndex + 1 }} of {{ @@igObjectRef.lastSearchInfo.matchCount }} results | ||
| </span> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchInfoCache.length == 0"> | ||
| <span *ngIf="@@igObjectRef.lastSearchInfo.matchCount == 0"> | ||
| No results | ||
|
Comment on lines
296
to
302
|
||
| </span> | ||
| </div> | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The template now accesses
@@igObjectRef.lastSearchInfo.matchCountwithout guardinglastSearchInfo. IflastSearchInfois undefined before the firstfindNext/findPrevcall, Angular will throw when evaluating the*ngIfexpressions. Consider restoring the*ngIf="@@igObjectRef.lastSearchInfo"guard or using the safe-navigation operator (e.g.,lastSearchInfo?.matchCount).