0

I have a search function in my application which gets me customers. Therefore I got an complex "Customer" object. So the list is of type Customer.

This list is filled properly on button click. But when I want to clear the list on Button click a error is thrown in my browser console:

TypeError: Cannot read property 'length' of undefined

What is the correct way to clear a list of complex object? Currently I am using a General Service which does the following:

tw.local.searchResults = new tw.object.listOf.Customer();

This throws me the above error.

Any Ideas?

4

1 回答 1

1

检查列表的长度,例如它的长度是否未定义,然后读取 if 块内的结果。

于 2017-06-29T06:43:00.537 回答