I want to implement text-search for a ListView.
And I don't want to use Tramsform
or SQL
because the app call too much APIs for retrieving data.
So I used Event Handler
of textInput and run the code below when the value of textInput changes.
But the problem is it didn't change the content of the listView on screen.
function transformData(data) {
const searchText = textInput1.value;
// Perform text search transformation on data
const data_filtered = []
data.forEach( obj => {
const obj_text = JSON.stringify(obj)
if (obj_text.includes(searchText)){
data_filtered.push(obj)
}
})
return data_filtered;
}
const data = listView1.data;
const new_data = transformData(data);
listView1.data = new_data
What is wrong?
Thnak you in advance.