BoldDeskWe are launching BoldDesk on Product Hunt soon. Learn more & follow us.
Not sure if this is a bug or I'm missing something in when builder the rendertree but when trying to add a dynamically created combobox the combobox renders and binds to the data but the text values all appear to be empty. Here's a sample code fragment i'm using:
I should add that the event is being called fine - but nothing is show for each item in the bound list, it also appears that if I switch the render order so the field setting are rendered after the event call back then the combo displays correctly but the event never fires.
I've also discovered that if I swap the childcontent section in debug with a hot reload it works as expected
Thanks
var propInfoValue = o.GetType().GetProperty(propertyInfo.Name);
var constant = System.Linq.Expressions.Expression.Constant(o, o.GetType());
var exp = System.Linq.Expressions.MemberExpression.Property(constant, propertyInfo.Name);
builder.OpenComponent(0, typeof(Syncfusion.Blazor.DropDowns.SfComboBox
builder.AddAttribute(1, "DataSource", sharedLookup.GetItems());
var defaultValue = propInfoValue.GetValue(o);
builder.AddAttribute(2, "Value", defaultValue);
builder.AddAttribute(3, "PlaceHolder", DisplayName);
builder.AddAttribute(4, "FloatLabelType", FloatLabelType.Always);
builder.AddAttribute(5, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((fieldSettingBuilder) =>
{
fieldSettingBuilder.OpenComponent
fieldSettingBuilder.AddAttribute(2, "Value", "ID");
fieldSettingBuilder.AddAttribute(3, "Text", "Name");
fieldSettingBuilder.CloseComponent();
}));
builder.AddAttribute(6, "ChildContent", (Microsoft.AspNetCore.Components.RenderFragment)((builderComboBoxEvents) =>
{
builderComboBoxEvents.OpenComponent
builderComboBoxEvents.AddAttribute(2, "OnValueSelect", EventCallback.Factory.Create
builderComboBoxEvents.CloseComponent();
}));
builder.CloseComponent();
Hi Richard,
You can achieve your requirement by using the below code example on your application.
Find the code example here:
b.AddAttribute(10, "ChildContent", (RenderFragment)(b2 => { b2.OpenComponent<ComboBoxEvents<string, ComboData>>(11); b2.AddAttribute(12, "OnValueSelect", Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck(EventCallback.Factory.Create<SelectEventArgs<string>>(this, DropDownChange))); b2.CloseComponent();
b2.OpenComponent<ComboBoxFieldSettings>(13); b2.AddAttribute(14, "Value", "DisplayValue"); b2.CloseComponent();
}));
b.CloseComponent(); b.CloseElement(); }; |
Regards,
Sureshkumar P
Perfect thanks
R