Added custom search functionality

This commit is contained in:
2025-02-05 18:12:34 +01:00
parent 46f14d3ddb
commit 8db0f84a80
3 changed files with 49 additions and 14 deletions

View File

@@ -1,7 +1,22 @@
using HopFrame.Web.Components.Pages;
using System.Collections;
using HopFrame.Web.Components.Pages;
namespace HopFrame.Web.Plugins.Events;
public sealed class SearchEvent(HopFrameTablePage sender) : HopFrameTablePageEventArgs(sender) {
public required string SearchTerm { get; set; }
public required int CurrentPage { get; init; }
internal IEnumerable<object>? SearchResult { get; set; }
internal int TotalPages { get; set; }
/// <summary>
/// Sets the new search result that is being displayed<br />
/// The event needs to be canceled in order for the custom search results to appear
/// </summary>
/// <param name="result">The current page of search results</param>
/// <param name="totalPages">The total pages of search results</param>
public void SetSearchResult(IEnumerable result, int totalPages) {
SearchResult = result.OfType<object>();
TotalPages = totalPages;
}
}