Hi,
I think the order of AutoUi providers in DotVVM.AutoUI.AddBusinessPackProviders
should be modified.
I use selectors to select int
ID from dropdown of objects most often. In default provider order, the site renders numeric input instead of dropdown. BpSelectorDropDownListEditorProvider
should occur before BpNumericUpDownEditorProvider
. I can’t think of any negative effects after reordering.
Model:
[Display(Name = "Tank:")]
[Selection(typeof(CatalogSelection<Tank>))]
public int? TankId { get; set; }
Original order:
public static
#nullable disable
AutoUIConfiguration AddBusinessPackProviders(
this AutoUIConfiguration config,
IDotvvmServiceCollection services)
{
config.FormEditorProviders.InsertRange(0, (IEnumerable<IFormEditorProvider>) new IFormEditorProvider[6]
{
(IFormEditorProvider) new BpCheckBoxEditorProvider(),
(IFormEditorProvider) new BpDateTimeEditorProvider(),
(IFormEditorProvider) new BpNumericUpDownEditorProvider(),
(IFormEditorProvider) new BpSelectorDropDownListEditorProvider(),
(IFormEditorProvider) new BpMultiSelectEditorProvider(),
(IFormEditorProvider) new BpTextBoxEditorProvider()
});
config.GridColumnProviders.AddRange((IEnumerable<IGridColumnProvider>) new IGridColumnProvider[5]
{
(IGridColumnProvider) new BpCheckBoxGridColumnProvider(),
(IGridColumnProvider) new BpDateTimeGridColumnProvider(),
(IGridColumnProvider) new BpNumericUpDownGridColumnProvider(),
(IGridColumnProvider) new BpSelectorDropDownGridColumnProvider(),
(IGridColumnProvider) new BpTextGridColumnProvider()
});
services.Services.Configure<DotvvmConfiguration>((Action<DotvvmConfiguration>) (c1 =>
{
c1.Markup.AddCodeControls("auto", typeof (AutoBpForm));
StyleRepository styles = c1.Styles;
styles.Register<AutoBpGridViewColumns>().SetDotvvmProperty<AutoBpGridViewColumns>((DotvvmProperty) DotVVM.Framework.Controls.Styles.AppendProperty, (Func<IStyleMatchContext<AutoBpGridViewColumns>, object>) (c2 => (object) AutoBpGridViewColumns.Replace(c2))).Remove<AutoBpGridViewColumns>();
styles.Register<AutoBpGridViewColumn>().ReplaceWith<AutoBpGridViewColumn>((Func<IStyleMatchContext<AutoBpGridViewColumn>, DotvvmBindableObject>) (c3 => (DotvvmBindableObject) AutoBpGridViewColumn.Replace(c3)));
}));
return config;
}
Side note (does not relate directly to thread): My customer is missing “key navigation” in BP dropdown list. It means if you open dropdown and press “B” the focus should be switched to option starting with letter “B”. This could be useful. I will probably use ComboBox in AutoUi because of this requirement. Or maybe implement some kind of decision logic, that will be based on number of options.