Skip to content

Commit

Permalink
fix: fixed issue about set Suggestions property
Browse files Browse the repository at this point in the history
  • Loading branch information
yagizhanNY committed May 27, 2024
1 parent 129d3c8 commit a0d3e15
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public partial class CategoryFilter
private Dictionary<string, Category>? _categories;
private FilterState? _filterState;
private Dictionary<string, string>? _nonSelectableCategories;
private string[] _suggestions = [];
private Lazy<Task<IJSObjectReference>>? moduleTask;
private BaseInterop? _interop;

Expand Down Expand Up @@ -66,7 +67,15 @@ public partial class CategoryFilter
[Parameter]
public bool RepeatCategories { get; set; } = true;
[Parameter]
public string[]? Suggestions { get; set; }
public string[]? Suggestions
{
get => _suggestions;
set
{
_suggestions = value;
InitialParameter("setSuggestions", new Dictionary<string, string[]> { { "suggestions", _suggestions } });
}
}
[Parameter]
public EventCallback<FilterState> FilterChangedEvent { get; set; }
[Parameter]
Expand Down
12 changes: 11 additions & 1 deletion SiemensIXBlazor/wwwroot/js/interops/categoryFilterInterop.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,14 @@ export function setNonSelectableCategories(id, nonSelectableCategories) {

}

}
}

export function setSuggestions(id, suggestionsObject) {
try {
const element = document.getElementById(id);
element.suggestions = JSON.parse(suggestionsObject).suggestions;
}
catch {

}
}

0 comments on commit a0d3e15

Please sign in to comment.