Skip to content

Commit

Permalink
DataSource.removeAll
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed May 29, 2024
1 parent b8bb3ff commit cfab100
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions haxe/ui/data/DataSource.hx
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,16 @@ class DataSource<T> {
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);
Expand Down

0 comments on commit cfab100

Please sign in to comment.