In my apps I follow the concept of user definable filters which can be selected by other users to filter their data. I took this idea from user interface of Microsoft Team Foundation Server ui. I store those filter definitions in a separate table called "ticketfilteroptionen" is part of another post in this blog. To implement this mechanism in a new main page you can follow the steps described in this post.
Definition of filter dropdown in ui
Modifications of load method in main page
Defintion of search variable
Definition of variable multiplevalues in partial class of page
List<Guid> _multipleValues;
public List<Guid> multipleValues
{
get
{
return _multipleValues;
}
set
{
if (_multipleValues != value)
{
_multipleValues = value;
InvokeAsync(SaveStateAsync2);
}
}
}
Definition of SaveStateAsync2 method
protected bool allowRowSelectOnRowClick = true;
protected RadzenDropDownDataGrid<System.Collections.Generic.List<System.Guid>> dropdownDataGridFilter;
public ApplicationUserState state = new ApplicationUserState();
/// <summary>
/// Sichert die State-Daten des dropdownDataGrids in den State-Speicher
/// </summary>
/// <returns></returns>
private async Task SaveStateAsync2()
{
await Task.CompletedTask;
await state.SetData(Security, "Beleg", "dropdownDatagridFilter", ApplicationUserState.Screentypes.Desktop, "dropdownDataGridFilterSettings", JsonSerializer.Serialize<List<Guid>>(multipleValues));
}
Transfer selected filter dropdown values in search variable
if (multipleValues != null)
{
foreach (var item in multipleValues)
{
Models.EEvolution.Ticketfilteroptionen ticketfilter = EEvolution.GetTicketfilteroptionenById(item).Result;
Globals.SelectedBelegFilterString = (Globals.SelectedBelegFilterString == "") ? ticketfilter.FILTER : Globals.SelectedBelegFilterString + " && " + ticketfilter.FILTER;
}
};
Set default value for search variable if no filter is selected
Replace active user login variable from filter definition because of scope problems during execution of main LINQ statement
if (Globals.SelectedBelegFilterString.Contains("#User.eEvolutionLogin#")) {
Globals.SelectedBelegFilterString = Globals.SelectedBelegFilterString.Replace("#User.eEvolutionLogin#", "\"" + Security.User.eEvolutionLogin + "\"");
}
Example of filter settings for main load select
Set filter for dropdown list so that only filters for this page are shown
Finally at least one filter should be defined as system filter, which is then available to all users
Eventually table values in dropdown list "Tabelle" have to be extended so that your needed table is shown here
new List<DropdownValue>(){new DropdownValue(){Id = 0, Name="ARBEITSBERICHTE"}, new DropdownValue(){Id = 1, Name="PROJEKTE"}, new DropdownValue(){Id = 2, Name="TICKET"}, new DropdownValue(){Id = 3, Name="LEAD"}, new DropdownValue(){Id = 4, Name="INTERESSENT"}, new DropdownValue(){Id = 5, Name="KUNDE"}, new DropdownValue(){Id = 6, Name="AAGFAKT"}}