ildar-shaymukhametov_grandnode-refactorings/Grand.Web/Areas/Admin/Views/Setting/Catalog.TabSortOptions.cshtml
@model CatalogSettingsModel

<div class="panel panel-default">
    <div class="panel-body">
        <div id="sortoptions-grid"></div>
    </div>
</div>

<script>
    $(document).ready(function () {
        $("#sortoptions-grid").kendoGrid({
            dataSource: {
                transport: {
                    read: {
                        url: "@Html.Raw(Url.Action("SortOptionsList", "Setting"))",
                        type: "POST",
                        dataType: "json",
                        data: addAntiForgeryToken
                    },
                    update: {
                        url: "@Html.Raw(Url.Action("SortOptionUpdate", "Setting"))",
                        type: "POST",
                        dataType: "json",
                        data: addAntiForgeryToken
                    }
                },
                schema: {
                    data: "Data",
                    total: "Total",
                    errors: "Errors",
                    model: {
                        id: "Id",
                        fields: {
                            Name: { editable: false, type: "string" },
                            DisplayOrder: { editable: true, type: "number" },
                            IsActive: { editable: true, type: "boolean" }
                        }
                    }
                },
                requestEnd: function (e) {
                    if (e.type == "update") {
                        this.read();
                    }
                },
                error: function (e) {
                    display_kendoui_grid_error(e);
                    // Cancel the changes
                    this.cancelChanges();
                },
                serverPaging: true,
                serverFiltering: true,
                serverSorting: true
            },
            pageable: {
                refresh: true,
                numeric: false,
                previousNext: false,
                info: false
            },
            editable: {
                confirmation: false,
                mode: "inline"
            },
            scrollable: false,
            columns: [{
                field: "Name",
                title: "@T("Admin.Configuration.Settings.Catalog.SortOptions.Name")",
                width: 250
            }, {
                field: "DisplayOrder",
                title: "@T("Admin.Configuration.Settings.Catalog.SortOptions.DisplayOrder")",
                //integer format
                format: "{0:0}",
                width: 100
            }, {
                field: "IsActive",
                title: "@T("Admin.Configuration.Settings.Catalog.SortOptions.IsActive")",
                width: 100,
                headerAttributes: { style: "text-align:center" },
                attributes: { style: "text-align:center" },
                template: '# if(IsActive) {# <i class="fa fa-check" aria-hidden="true" style="color:green"></i> #} else {# <i class="fa fa-times" aria-hidden="true" style="color:red"></i> #} #'
            },  {
                command: {
                    name: "edit",
                    text: {
                        edit: "@T("Admin.Common.Edit")",
                        update: "@T("Admin.Common.Update")",
                        cancel: "@T("Admin.Common.Cancel")"
                    }
                },
                title: "@T("Admin.Common.Edit")",
                width: 150
            }]
        });
    });
</script>