From 0e6714b670429d610d5a05f56104c87701a7e776 Mon Sep 17 00:00:00 2001 From: Backiaraj Date: Tue, 18 Jun 2024 12:06:07 +0530 Subject: [PATCH] Updated the sample --- .../Pages/DataGridFeatures.razor | 79 +++++++ .../Pages/Index.razor | 123 +++++----- .../Pages/_Host.cshtml | 6 + .../Shared/MainLayout.razor | 220 ++++++++++++++++-- .../Shared/NavMenu.razor | 77 +++--- .../wwwroot/images/ToggleButton.png | Bin 0 -> 151 bytes 6 files changed, 405 insertions(+), 100 deletions(-) create mode 100644 PreventQueryGeneration/Grid_PreventQueryGeneration/Pages/DataGridFeatures.razor create mode 100644 PreventQueryGeneration/Grid_PreventQueryGeneration/wwwroot/images/ToggleButton.png 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 0000000000000000000000000000000000000000..33b793e70a8f7e59ae8bbe01467b11c57edb6e5f GIT binary patch literal 151 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM1|%Pp+x`GjoCO|{#S9GG!XV7ZFl!D-1!HlL zyA#8@b22Z19F}xPUq=Rpjs4tz5?O(K9Zwg>kP61P7ae&S7&s0eU|ssd+^~sVPUSV{ qi{(NEhsu7(