Fixes for InputAttributes in SimpleSelect
This commit is contained in:
		
							parent
							
								
									e83e46abc0
								
							
						
					
					
						commit
						a90cf518a3
					
				@ -6,12 +6,13 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
<p>SelectedValue: @SelectedValue.ToString()</p>
 | 
					<p>SelectedValue: @SelectedValue.ToString()</p>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<SimpleSelect
 | 
					<CheckBoxGroup Id="chkgroup1">
 | 
				
			||||||
    Items="@items" 
 | 
					    <CheckBox Id="checkbox1" Label="Chk 1" />
 | 
				
			||||||
    Label="Simple select" 
 | 
					    <CheckBox Id="checkbox2" Label="Chk 2" />
 | 
				
			||||||
    @bind-Value=@SelectedValue
 | 
					    <CheckBox Id="checkbox3" Label="Chk 3" />
 | 
				
			||||||
/>
 | 
					    <CheckBox Id="checkbox4" Label="Chk 4" />
 | 
				
			||||||
 | 
					    <CheckBox Id="checkbox5" Label="Chk 5" />
 | 
				
			||||||
 | 
					</CheckBoxGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@code {
 | 
					@code {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -76,13 +76,18 @@ public partial class SimpleSelect<ValueType> : InputBase
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
	protected override async Task OnParametersSetAsync()
 | 
						protected override async Task OnParametersSetAsync()
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (base.InputAttributes is null) base.InputAttributes = new();
 | 
							
 | 
				
			||||||
		if (base.Required)
 | 
					 | 
				
			||||||
		{
 | 
					 | 
				
			||||||
			if (base.InputAttributes.ContainsKey("required")) base.InputAttributes.Add("required", true);
 | 
					 | 
				
			||||||
		}
 | 
					 | 
				
			||||||
		OriginalItems = Items;
 | 
							OriginalItems = Items;
 | 
				
			||||||
		if (_searchText.Length>0) await FilterItems();
 | 
							if (_searchText.Length>0) await FilterItems();
 | 
				
			||||||
 | 
							await base.OnParametersSetAsync();
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						protected override async Task OnInitializedAsync()
 | 
				
			||||||
 | 
						{
 | 
				
			||||||
		await base.OnInitializedAsync();
 | 
							await base.OnInitializedAsync();
 | 
				
			||||||
 | 
							if (Required)
 | 
				
			||||||
 | 
							{
 | 
				
			||||||
 | 
								if (InputAttributes.ContainsKey("required")) InputAttributes.Add("required", true);
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user