Call dropdown item's display_title() method also for rendering within the dropdown when open (#1410)
Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
This commit is contained in:
parent
df2d6967ca
commit
5ccdba41af
1 changed files with 7 additions and 1 deletions
|
|
@ -195,10 +195,16 @@ where
|
||||||
.map_or(Size::Medium, |dropdown| dropdown.read(cx).size);
|
.map_or(Size::Medium, |dropdown| dropdown.read(cx).size);
|
||||||
|
|
||||||
if let Some(item) = self.delegate.item(ix) {
|
if let Some(item) = self.delegate.item(ix) {
|
||||||
|
let content = item.display_title().unwrap_or_else(|| {
|
||||||
|
div()
|
||||||
|
.whitespace_nowrap()
|
||||||
|
.child(item.title().to_string())
|
||||||
|
.into_any_element()
|
||||||
|
});
|
||||||
let list_item = DropdownListItem::new(ix.row)
|
let list_item = DropdownListItem::new(ix.row)
|
||||||
.selected(selected)
|
.selected(selected)
|
||||||
.with_size(size)
|
.with_size(size)
|
||||||
.child(div().whitespace_nowrap().child(item.title().to_string()));
|
.child(content);
|
||||||
Some(list_item)
|
Some(list_item)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue