diff --git a/PreventQueryGeneration/Grid_PreventQueryGeneration/Pages/DataGridFeatures.razor b/PreventQueryGeneration/Grid_PreventQueryGeneration/Pages/DataGridFeatures.razor new file mode 100644 index 0000000..ee8cbc4 --- /dev/null +++ b/PreventQueryGeneration/Grid_PreventQueryGeneration/Pages/DataGridFeatures.razor @@ -0,0 +1,79 @@ +@page "/datagrid-features" + +@using System.ComponentModel.DataAnnotations; +@using Syncfusion.Blazor +@using Syncfusion.Blazor.Data +@using Syncfusion.Blazor.Buttons +@using Syncfusion.Blazor.Grids +@using Syncfusion.Blazor.DropDowns +@using Newtonsoft.Json + + + + + + + + + + + + + + + + + + + +@code{ + SfGrid Grid { get; set; } + + + + private Query currentQuery = new Query(); + public List ToolbarItems = new List() { "Add", "Edit", "Delete", "Update", "Cancel", "Search" }; + + private void OnActionBegin(Syncfusion.Blazor.Grids.ActionEventArgs args) + { + + if (args.RequestType == Syncfusion.Blazor.Grids.Action.Filtering) + { + + if (String.Equals(args.CurrentFilteringColumn, nameof(Book.CustomerId), StringComparison.OrdinalIgnoreCase)) + { + args.PreventFilterQuery = true; + currentQuery = new Query().Where("Customer/Name", args.CurrentFilterObject.Operator.ToString().ToLower(), args.CurrentFilterObject.Value, true, true); + } + } + } + + + public class Book + { + [Key] + public Guid Id { get; set; } + public Guid CustomerId { get; set; } + public Guid CustomerId1 { get; set; } + public virtual Customer Customer { get; set; } + public int CreditLimit { get; set; } + public bool Active { get; set; } + public bool IsDeleted { get; set; } + } + + public class Customer + { + [Key] + public Guid Id { get; set; } + public string Name { get; set; } + + [JsonIgnore] + public List CustomerBooks { get; set; } + + } + } \ No newline at end of file diff --git a/PreventQueryGeneration/Grid_PreventQueryGeneration/Pages/Index.razor b/PreventQueryGeneration/Grid_PreventQueryGeneration/Pages/Index.razor index b76c421..e2521fc 100644 --- a/PreventQueryGeneration/Grid_PreventQueryGeneration/Pages/Index.razor +++ b/PreventQueryGeneration/Grid_PreventQueryGeneration/Pages/Index.razor @@ -1,62 +1,75 @@ @page "/" -@using System.ComponentModel.DataAnnotations; -@using Syncfusion.Blazor -@using Syncfusion.Blazor.Data -@using Syncfusion.Blazor.Grids -@using Syncfusion.Blazor.DropDowns -@using Newtonsoft.Json - - - - - - - - - - - - - - - - -@code { - SfGrid Grid { get; set; } - private Query currentQuery = new Query(); - public List ToolbarItems = new List() { "Add", "Edit", "Delete", "Update", "Cancel", "Search" }; - - private void OnActionBegin(Syncfusion.Blazor.Grids.ActionEventArgs args) - { - if (args.RequestType == Syncfusion.Blazor.Grids.Action.Filtering) - { - if (String.Equals(args.CurrentFilteringColumn, nameof(Book.CustomerId), StringComparison.OrdinalIgnoreCase)) - { - args.PreventFilterQuery = true; - currentQuery = new Query().Where("Customer/Name", args.CurrentFilterObject.Operator.ToString().ToLower(), args.CurrentFilterObject.Value, true, true); - } - } +Selected Controls +
+

The following Syncfusion Blazor components can be set up in an application for you with the Syncfusion Blazor Template Studio. A fast, easy start with Syncfusion Blazor components lets you concentrate on the important part: learning.

+
+ +
Grids
+
    +
  • + + DataGrid + +
  • + +
+ +
+ \ No newline at end of file diff --git a/PreventQueryGeneration/Grid_PreventQueryGeneration/Pages/_Host.cshtml b/PreventQueryGeneration/Grid_PreventQueryGeneration/Pages/_Host.cshtml index be1403f..e10df86 100644 --- a/PreventQueryGeneration/Grid_PreventQueryGeneration/Pages/_Host.cshtml +++ b/PreventQueryGeneration/Grid_PreventQueryGeneration/Pages/_Host.cshtml @@ -32,5 +32,11 @@ + diff --git a/PreventQueryGeneration/Grid_PreventQueryGeneration/Shared/MainLayout.razor b/PreventQueryGeneration/Grid_PreventQueryGeneration/Shared/MainLayout.razor index a1533f1..29d0ab4 100644 --- a/PreventQueryGeneration/Grid_PreventQueryGeneration/Shared/MainLayout.razor +++ b/PreventQueryGeneration/Grid_PreventQueryGeneration/Shared/MainLayout.razor @@ -1,19 +1,213 @@ @inherits LayoutComponentBase +@inject IJSRuntime JS +@using Syncfusion.Blazor.Navigations + + + -Grid_PreventQueryGeneration +
+ -
- + + +@code +{ + SfSidebar Sidebar; + public bool SidebarToggle = false; + public bool SidebarToggleFixed = false; + + public void ToggleNavMenu() + { + SidebarToggle = !SidebarToggle; + SidebarToggleFixed = !SidebarToggleFixed; + } + + public async Task MouseIn(MouseEventArgs args) + { + var isSidebar = await JS.InvokeAsync("isSidebar", args.ClientX, args.ClientY); + if (!SidebarToggle && isSidebar) + { + SidebarToggle = true; + } + } + + public async Task MouseOut(MouseEventArgs args) + { + var isSidebar = await JS.InvokeAsync("isSidebar", args.ClientX, args.ClientY); + if (SidebarToggle && !isSidebar) + { + if (!SidebarToggleFixed) + { + SidebarToggle = false; + } + } + } +} diff --git a/PreventQueryGeneration/Grid_PreventQueryGeneration/Shared/NavMenu.razor b/PreventQueryGeneration/Grid_PreventQueryGeneration/Shared/NavMenu.razor index 122e0d0..b9cca30 100644 --- a/PreventQueryGeneration/Grid_PreventQueryGeneration/Shared/NavMenu.razor +++ b/PreventQueryGeneration/Grid_PreventQueryGeneration/Shared/NavMenu.razor @@ -1,39 +1,52 @@ - - - + + diff --git a/PreventQueryGeneration/Grid_PreventQueryGeneration/wwwroot/images/ToggleButton.png b/PreventQueryGeneration/Grid_PreventQueryGeneration/wwwroot/images/ToggleButton.png new file mode 100644 index 0000000..33b793e Binary files /dev/null and b/PreventQueryGeneration/Grid_PreventQueryGeneration/wwwroot/images/ToggleButton.png differ