diff --git a/native/MainPage.qml b/native/MainPage.qml index 09f918d..4f7a33b 100644 --- a/native/MainPage.qml +++ b/native/MainPage.qml @@ -185,12 +185,19 @@ Rectangle { filteredApiDataModel.clear() for (var i = 0; i < apiDataModel.count; ++i) { var item = apiDataModel.get(i) - if (item.name.toLowerCase().indexOf(searchText.toLowerCase()) !== -1 || - item.key.toLowerCase().indexOf(searchText.toLowerCase()) !== -1 || - item.amount.toLowerCase().indexOf(searchText.toLowerCase()) !== -1 || - item.start.toLowerCase().indexOf(searchText.toLowerCase()) !== -1 || - item.end.toLowerCase().indexOf(searchText.toLowerCase()) !== -1 || - item.group.toLowerCase().indexOf(searchText.toLowerCase()) !== -1) { + var name = item.name ? item.name.toString().toLowerCase() : "" + var key = item.key ? item.key.toString().toLowerCase() : "" + var amount = item.amount ? item.amount.toString().toLowerCase() : "" + var start = item.start ? item.start.toString().toLowerCase() : "" + var end = item.end ? item.end.toString().toLowerCase() : "" + var group = item.group ? item.group.toString().toLowerCase() : "" + + if (name.indexOf(searchText.toLowerCase()) !== -1 || + key.indexOf(searchText.toLowerCase()) !== -1 || + amount.indexOf(searchText.toLowerCase()) !== -1 || + start.indexOf(searchText.toLowerCase()) !== -1 || + end.indexOf(searchText.toLowerCase()) !== -1 || + group.indexOf(searchText.toLowerCase()) !== -1) { filteredApiDataModel.append(item) } }