var GanttQueryData = new Syncfusion.Blazor.Data.Query().Sort("Column1", null);
|
<SfGantt @ref="myGantt" ID="GanttExport" TValue="Table" HighlightWeekends="true" RowHeight="75" DurationUnit="DurationUnit.Day"
Toolbar="@(new List<string>(){ "Add", "Edit", "Update", "Delete", "Cancel", "ExpandAll", "CollapseAll"})">
<SfDataManager Adaptor="Adaptors.CustomAdaptor">
<CustomComponent QueryData="@GanttQueryData" SortQuery="@GanttSortQuery"></CustomComponent>
</SfDataManager>
</SfGantt>
@code {
public List<SortedColumn> GanttSortQuery = new List<SortedColumn>();
protected override void OnInitialized()
{
GanttSortQuery.Add(new SortedColumn() { Field = "Name", Direction = SortOrder.Ascending });
GanttSortQuery.Add(new SortedColumn() { Field = "Id", Direction = SortOrder.Ascending });
}
}
@code {
[Parameter]
public List<SortedColumn> SortQuery { get; set; }
ganttcheckContext db = new ganttcheckContext();
// Performs data Read operation
public override object Read(DataManagerRequest dm, string key = null)
{
IEnumerable<Table> DataSource = db.Table;
if (SortQuery != null && SortQuery.Count > 0)
{
DataSource = DataOperations.PerformSorting(DataSource, SortQuery);
}
int count = DataSource.Cast<Table>().Count();
return dm.RequiresCounts ? new DataResult() { Result = DataSource, Count = count } : (object)Service.Table;
} |
|
public override object Read(DataManagerRequest dm, string key = null)
{
...
if (SortQuery != null && SortQuery.Count > 0)
{
IEnumerable<Table> nullvalues = DataSource.Where(e => e.Name == null);
DataSource = DataOperations.PerformSorting(DataSource.Where(e=> e.Name !=null), SortQuery);
DataSource = DataSource.Concat(nullvalues);
}
int count = DataSource.Cast<Table>().Count();
return dm.RequiresCounts ? new DataResult() { Result = DataSource, Count = count } : (object)Service.Table;
}
|
|
public void ConfigureServices(IServiceCollection services)
{
services.AddSyncfusionBlazor();
services.AddRazorPages();
services.AddServerSideBlazor();
services.AddSingleton<WeatherForecastService>();
} |