@model IEnumerable<FlexGridData.Sale>

<h1>
    CollectionView Sorting
</h1>

<p>
    Use the <b>CollectionView.sortDescriptions</b> property to specify
    which fields should be sorted and in which direction.
</p>
<p>
    Choose one of the options to see it in action:
</p>

<label>
    <input type="radio" name="sort" value="" checked="true" />
    No Sort
</label>
<label>
    <input type="radio" name="sort" value="Country" />
    Sort by Country
</label>
<label>
    <input type="radio" name="sort" value="Country,Sales" />
    Sort by Country and Sales
</label>
<label>
    <input type="radio" name="sort" value="Country,Sales,Downloads" />
    Sort by Country, Sales, and Downloads
</label>

<p>
    Result:
</p>
@(Html.C1().FlexGrid().Id("theGrid").Height(250)
    .Bind(b=>b.Bind(Model).DisableServerRead(true))
    .AutoGenerateColumns(false)
    .Columns(cs=>
    {
        cs.Add().Binding("Country").Header("Country");
        cs.Add().Binding("Downloads").Header("Downloads");
        cs.Add().Binding("Sales").Header("Sales");
        cs.Add().Binding("Expenses").Header("Expenses");
    })
    .ShowSort(true)
    .AllowSorting(false) // sorting done by us, not by the grid
    .ShowAlternatingRows(false)
    .HeadersVisibility(C1.Web.Mvc.Grid.HeadersVisibility.Column)
)