Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion examples/Demo/Shared/Pages/Lab/IssueTester.razor
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@




10 changes: 10 additions & 0 deletions src/Core/Components/Search/FluentSearch.razor.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// ------------------------------------------------------------------------
// MIT License - Copyright (c) Microsoft Corporation. All rights reserved.
// ------------------------------------------------------------------------

using System.Diagnostics.CodeAnalysis;
using Microsoft.AspNetCore.Components;
using Microsoft.FluentUI.AspNetCore.Components.Extensions;
Expand Down Expand Up @@ -93,6 +97,12 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
await Module.InvokeVoidAsync("setControlAttribute", Id, "autocomplete", AutoComplete);
}
}

if (DataList != null && !string.IsNullOrEmpty(Id))
{
Module ??= await JSRuntime.InvokeAsync<IJSObjectReference>("import", JAVASCRIPT_FILE.FormatCollocatedUrl(LibraryConfiguration));
await Module.InvokeVoidAsync("setDataList", Id, DataList);
}
}

protected override bool TryParseValueFromString(string? value, out string? result, [NotNullWhen(false)] out string? validationErrorMessage)
Expand Down
12 changes: 12 additions & 0 deletions src/Core/Components/Search/FluentSearch.razor.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,15 @@ export function setControlAttribute(id, attrName, value) {
fieldElement?.setAttribute(attrName, value);
}
}

export function setDataList(id, datalistid) {
const fieldElement = document.getElementById(id);
const dataList = document.getElementById(datalistid)?.cloneNode(true);

const shadowRoot = fieldElement.shadowRoot;
const shadowDataList = shadowRoot.getElementById(datalistid);
if (shadowDataList) {
shadowRoot.removeChild(shadowDataList);
}
shadowRoot.appendChild(dataList);
}