From cfab100e2c82e8854cf8ec363cfb424ed01c1ec7 Mon Sep 17 00:00:00 2001 From: Ian Harrigan Date: Wed, 29 May 2024 22:09:44 +0200 Subject: [PATCH] DataSource.removeAll --- haxe/ui/data/DataSource.hx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/haxe/ui/data/DataSource.hx b/haxe/ui/data/DataSource.hx index 52ca18561..96c8346b8 100644 --- a/haxe/ui/data/DataSource.hx +++ b/haxe/ui/data/DataSource.hx @@ -102,6 +102,16 @@ class DataSource { var item = get(index); return remove(item); } + + public function removeAll():Void { + var originalAllowCallbacks = _allowCallbacks; + _allowCallbacks = false; + while (size > 0) { + removeAt(0); + } + _allowCallbacks = originalAllowCallbacks; + handleChanged(); + } public function update(index:Int, item:T):T { var r = handleUpdateItem(index, item);