@(Html.EJ().Grid<object>("FlatGrid")
.Datasource(ds =>
ds.URL("http://services.odata.org/V4/Northwind/Northwind.svc/Customers")
.Adaptor(AdaptorType.ODataV4Adaptor))
.AllowFiltering()
.AllowSorting()
.SortSettings(b =>
b.SortedColumns(col =>
col.Field("Orders.0.Customer.CustomerID")
.Direction(SortOrder.Ascending).Add()))
. . .
.Query("new ej.Query().select(['CompanyName']).expand(['Orders'])")
. . .
) |
@(Html.EJ().Grid<object>("FlatGrid")
.Datasource(ds =>
ds.URL("http://services.odata.org/V4/Northwind/Northwind.svc/Orders")
.Adaptor(AdaptorType.ODataV4Adaptor))
.EnableRowHover(false)
.Query("new ej.Query().select(['OrderID']).expand(['Customer'])")
)
<script>
var onEachSort = ej.ODataV4Adaptor.prototype.onEachSort;
ej.ODataV4Adaptor.prototype.onEachSort = function (e) {
var res = [];
if (!(e.name instanceof Array) && e.name.split(".").length > 1) {
res.push(this._p(e.name) + (e.direction === "descending" ? " desc" : ""));
return res.join(",");
}
return onEachSort.apply(this, [e]);
};
</script> |