If I specify both sorting and grouping - with initial sort settings on the grouped columns, the sort is ignored. How can I force the groups into a specific order on initial load? Sample is below.
@(Html.EJS().Grid("serviceChargesGrid")
.DataSource(dataSource)
.AllowResizing()
.Columns(col =>
{
col.Field("xaction_id").HeaderText("Row ID").IsPrimaryKey(true).Visible(false).AllowEditing(false).Add();
col.Field("wrapper_id").Visible(false).AllowEditing(false).Add();
col.Field("PlatformName").Visible(false).HeaderText("Product Provider").Width("300").AllowEditing(false).Add();
col.Field("OwnerForename").Visible(false).HeaderText("Product Provider").Width("300").AllowEditing(false).Add();
col.Field("WrapperName").Visible(false).HeaderText("Plan / Investment").Width("200").AllowEditing(false).Add();
col.Field("PolicyNumber").Visible(false).HeaderText("Policy Number").Width("120").TextAlign(TextAlign.Center).AllowEditing(false).Add();
col.Field("source").HeaderText("Source of Data").TextAlign(TextAlign.Center).Template("#DataSourceTemplate").Width("120").AllowEditing(false).Add();
col.Field("Type").HeaderText("Type").Width("200").AllowEditing(false).Add();
col.Field("Details").HeaderText("Details").Width("200").AllowEditing(false).Add();
col.Field("Date").HeaderText("Date").Type("date").EditType("datepickeredit").TextAlign(TextAlign.Center).Width("120").Add();
col.Field("Amount").HeaderText($"Amount {symbol}").EditType("numericedit").Type("number").Edit(new { @params = new NumericTextBox { Decimals = 2, Format = "n2", ValidateDecimalOnType = true, Step = 1.00 } }).Format("N2").TextAlign(TextAlign.Right).Width("180").Add();
col.HeaderText("").Commands(commands).Width("100").Add();
})
.ActionBegin("actionBegin")
.ActionComplete("actionComplete")
.ActionFailure("actionFailure")
.Load("load")
.EditSettings(edit => { edit.AllowEditing(true).Mode(EditMode.Normal); })
.Height("100%")
.AllowGrouping()
.AllowSorting()
.SortSettings(sort => sort.Columns(new List<object> { new {field="PlatformName", direction="Ascending"}, new { field = "OwnerForename", direction = "Ascending" }, new { field = "WrapperName", direction = "Ascending" } }))
.AllowMultiSorting()
.EnablePersistence(false)
.GroupSettings(group =>
{
group.ShowDropArea(false).Columns(new[] { "wrapper_id", "Type" }).CaptionTemplate("#serviceChargesGroupTemplate");
})
.Aggregates(agg =>
{
agg.Columns(new List<GridAggregateColumn> {new GridAggregateColumn {Field = "Amount", Type = "Sum", Format="N2", GroupCaptionTemplate = "${Sum}", FooterTemplate = "<div class='grandTotal'>Total Service Charges ${Sum}</div>" } }).Add();
})
.Render())
}