Add support for invoking an init callback on component and element construction

This enables imperative code to be run. To be used sparingly :-)
This commit is contained in:
Simon Hausmann 2022-11-15 14:24:38 +01:00 committed by Simon Hausmann
parent 9baf6f2bde
commit 907b58161c
20 changed files with 366 additions and 46 deletions

View file

@ -1312,12 +1312,17 @@ public:
inner->data.resize(count);
for (int i = 0; i < count; ++i) {
auto &c = inner->data[i];
bool created = false;
if (!c.ptr) {
c.ptr = C::create(parent);
created = true;
}
if (c.state == RepeaterInner::State::Dirty) {
(*c.ptr)->update_data(i, *m->row_data(i));
}
if (created) {
(*c.ptr)->init();
}
}
} else {
inner->data.clear();