Default multi-sort on grid?

2 posts, 0 answers
  1. Jason
    Jason avatar
    44 posts
    Member since:
    Apr 2013

    Posted 06 Dec 2013 Link to this post

    So I have figured out how to give a grid a default sort order and it works good...  I would like to also be able to give it a secondary sort order...  first sort is "Bill Date" and then within rows that have the same bill date, they would be sort by "CoordinationOfBenefit".

    Also of note, I have enabled multisort in the .Sortable


                            .Scrollable(s => s.Height("auto"))
                            .HtmlAttributes(new { @class = "cursorLink", style= "height: 200px;" })
                            .DataSource(ds => ds.Ajax()
                                .Sort(sort => sort.Add("BillDate").Descending())
                                .Read("AccountClaimsData", "Workdriver", new { ProductName = ViewBag.SelectedProduct.ProductName, AccountId = Model.Account.AccountId })
                                .Events(e => e.Change("ClaimDataSourceChanged")))
                            .Columns(c =>
                                c.Bound(f => f.AccountClaimId).Visible(false);
                                c.Bound(f => f.ClaimNumber).Title("Claim Number").Width(125);
                                c.Bound(f => f.InsuranceCode).Title("Ins Code").Width(75);
                                c.Bound(f => f.CoordinationOfBenefit).Title("COB").Width(55);
                                c.Bound(f => f.ServiceDate).Title("Service").Format("{0:d}").Width(85);
                                c.Bound(f => f.BillDate).Title("Bill").Format("{0:d}").Width(85);
                                c.Bound(f => f.ClaimStatusRollupName).Title("Status").Width(100);
                                c.Bound(f => f.ClaimAmount).Title("Claim Amount").ClientTemplate("<span style='float: right;'>#=kendo.toString(ClaimAmount,'c')#</span>").Width(115);
                                c.Bound(f => f.PaidAmount).Title("Paid Amount").ClientTemplate("<span style='float: right;'>#=kendo.toString(PaidAmount,'c')#</span>").Width(110);
                                c.Bound(f => f.AdjustmentAmount).Title("Adjustment Amount").ClientTemplate("<span style='float: right;'>#=kendo.toString(AdjustmentAmount,'c')#</span>").Width(135);
                                c.Bound(f => f.PaidAmount).Title("Patient Amount").ClientTemplate("<span style='float: right;'>#=kendo.toString(PaidAmount,'c')#</span>").Width(125);
                            .Selectable(s => s.Mode(GridSelectionMode.Single))
                            .Sortable(s => s.SortMode(GridSortMode.MultipleColumn))
                            .Groupable(g =>
                                g.Messages(m =>
                                    m.Empty("Drag Column Header Here to Group");
                            .Events(e => e.Change("ClaimSelectionChanged"))
  2. Alexander Popov
    Alexander Popov avatar
    1444 posts

    Posted 09 Dec 2013 Link to this post

    Hello Jason,

    You can define the sorting using a Statement lambda, for example: 
    .DataSource(dataSource => dataSource
        .Sort(s =>

    Alexander Popov
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
Back to Top