开发者

How to delete items from ListField

开发者 https://www.devze.com 2023-03-10 18:46 出处:网络
I want to delete items 开发者_运维技巧and refresh it. I have been trying for 2 days, no luck. listField.delete(index) doesn\'t work.

I want to delete items 开发者_运维技巧and refresh it. I have been trying for 2 days, no luck.

listField.delete(index) doesn't work.

If you can provide me appropriate solution, I will give you all of my reputation.


You'll probably have to override it to remove the item from your data backing the list, and then call listField.setSize(newSize). Since it doesn't know what sort of data structure you are using to push elements into it, it can't be sure how to remove them.

For example, if you have a Vector that stores your data, override delete() to remove the element, and then call setSize(vector.size()). If your ListFieldCallback is stored somewhere else, just make a wrapper call to a similar delete() method in your callback.

0

精彩评论

暂无评论...
验证码 换一张
取 消