Skip to content

Commit

Permalink
dont allow datasources to change itemrenderer ids
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Sep 6, 2024
1 parent 5687d56 commit 0d6f3c2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions haxe/ui/core/ItemRenderer.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package haxe.ui.core;

import haxe.ui.util.RTTI;
import haxe.ui.components.Image;
import haxe.ui.components.Label;
import haxe.ui.containers.Box;
Expand All @@ -10,6 +9,7 @@ import haxe.ui.events.ItemRendererEvent;
import haxe.ui.events.MouseEvent;
import haxe.ui.events.UIEvent;
import haxe.ui.util.Color;
import haxe.ui.util.RTTI;
import haxe.ui.util.StringUtil;
import haxe.ui.util.TypeConverter;
import haxe.ui.util.Variant;
Expand Down Expand Up @@ -267,7 +267,10 @@ class ItemRenderer extends Box {
// "data" is a special case exception here as if the item renderer contained a "data" property
// it would overwrite the item renderers data property, which is, for sure, NOT
// what we want to happen... ever.
if (f != "data") {
// "id" is also a special case, its bad form to start renaming ids of sub components based on the
// datasource, unexpected things can happy when your itemrenderer has an id, then, without knowing
// your datasource changes that id - its "too magic"
if (f != "data" && f != "id") {
if (RTTI.hasPrimitiveClassProperty(this.className, f)) {
Reflect.setProperty(this, f, v);
}
Expand Down

0 comments on commit 0d6f3c2

Please sign in to comment.