Skip to content

Commit eb79612

Browse files
docs(searchbar): debounce uses ionInput (#2913)
Co-authored-by: guillaumesmo <[email protected]>
1 parent b0ac6e8 commit eb79612

File tree

7 files changed

+12
-12
lines changed

7 files changed

+12
-12
lines changed

docs/api/searchbar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ import Toolbar from '@site/static/usage/v7/toolbar/searchbars/index.md';
6666

6767
## Debounce
6868

69-
A debounce can be set on the searchbar in order to delay triggering the `ionChange` event. This is useful when querying data, as it can be used to wait to make a request instead of requesting the data each time a character is entered in the input.
69+
A debounce can be set on the searchbar in order to delay triggering the `ionInput` event. This is useful when querying data, as it can be used to wait to make a request instead of requesting the data each time a character is entered in the input.
7070

7171
import Debounce from '@site/static/usage/v7/searchbar/debounce/index.md';
7272

static/usage/v7/searchbar/debounce/angular/example_component_html.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
```html
2-
<ion-searchbar [debounce]="1000" (ionChange)="handleChange($event)"></ion-searchbar>
2+
<ion-searchbar [debounce]="1000" (ionInput)="handleInput($event)"></ion-searchbar>
33

44
<ion-list>
55
<ion-item *ngFor="let result of results">

static/usage/v7/searchbar/debounce/angular/example_component_ts.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export class ExampleComponent {
99
public data = ['Amsterdam', 'Buenos Aires', 'Cairo', 'Geneva', 'Hong Kong', 'Istanbul', 'London', 'Madrid', 'New York', 'Panama City'];
1010
public results = [...this.data];
1111

12-
handleChange(event) {
12+
handleInput(event) {
1313
const query = event.target.value.toLowerCase();
1414
this.results = this.data.filter(d => d.toLowerCase().indexOf(query) > -1);
1515
}

static/usage/v7/searchbar/debounce/demo.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
let results = [...data];
3737
filterItems(results);
3838

39-
searchbar.addEventListener('ionChange', handleChange);
39+
searchbar.addEventListener('ionInput', handleInput);
4040

41-
function handleChange(event) {
41+
function handleInput(event) {
4242
const query = event.target.value.toLowerCase();
4343
results = data.filter(d => d.toLowerCase().indexOf(query) > -1);
4444
filterItems(results);
@@ -61,4 +61,4 @@
6161
}
6262
</script>
6363

64-
</html>
64+
</html>

static/usage/v7/searchbar/debounce/javascript.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
let results = [...data];
1111
filterItems(results);
1212
13-
searchbar.addEventListener('ionChange', handleChange);
13+
searchbar.addEventListener('ionInput', handleInput);
1414
15-
function handleChange(event) {
15+
function handleInput(event) {
1616
const query = event.target.value.toLowerCase();
1717
results = data.filter(d => d.toLowerCase().indexOf(query) > -1);
1818
filterItems(results);

static/usage/v7/searchbar/debounce/react.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function Example() {
66
const data = ['Amsterdam', 'Buenos Aires', 'Cairo', 'Geneva', 'Hong Kong', 'Istanbul', 'London', 'Madrid', 'New York', 'Panama City'];
77
let [results, setResults] = useState([...data]);
88

9-
const handleChange = (ev: Event) => {
9+
const handleInput = (ev: Event) => {
1010
let query = "";
1111
const target = ev.target as HTMLIonSearchbarElement;
1212
if (target) query = target.value!.toLowerCase();
@@ -16,7 +16,7 @@ function Example() {
1616

1717
return (
1818
<>
19-
<IonSearchbar debounce={1000} onIonChange={(ev) => handleChange(ev)}></IonSearchbar>
19+
<IonSearchbar debounce={1000} onIonInput={(ev) => handleInput(ev)}></IonSearchbar>
2020

2121
<IonList>
2222
{ results.map(result => (

static/usage/v7/searchbar/debounce/vue.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
```html
22
<template>
3-
<ion-searchbar :debounce="1000" @ionChange="handleChange($event)"></ion-searchbar>
3+
<ion-searchbar :debounce="1000" @ionInput="handleInput($event)"></ion-searchbar>
44

55
<ion-list>
66
<ion-item v-for="result in results">
@@ -22,7 +22,7 @@
2222
return { data, results };
2323
},
2424
methods: {
25-
handleChange(event) {
25+
handleInput(event) {
2626
const query = event.target.value.toLowerCase();
2727
this.results = this.data.filter(d => d.toLowerCase().indexOf(query) > -1);
2828
},

0 commit comments

Comments
 (0)