select item on dropdown build

This commit is contained in:
yggverse 2024-12-06 23:39:16 +02:00
parent 1d5fa4febb
commit fd5a7196b1

View File

@ -122,16 +122,16 @@ impl List {
// Init main widget
let dropdown = DropDown::builder()
.model(&list_store)
.selected(
list_store
.find_with_equal_func(|item| {
item.dynamic_cast_ref::<Item>().unwrap().is_active()
})
.unwrap(),
)
.factory(&factory)
.build();
// Select active record
dropdown.set_selected(
list_store
.find_with_equal_func(|item| item.dynamic_cast_ref::<Item>().unwrap().is_active())
.unwrap(),
); // @TODO panic or handle?
// Return activated `Self`
Self {
list_store,