kendo ui grid datasource filter Datum-format

Ich habe einen kendo-raster mit einem Datum-Feld in der datasource.
Bei der Anzeige des Feldes habe ich eine Vorlage verwenden, um das Datum anzuzeigen, die in der UK-date-format 'dd/MM/yyyy'.
Das problem ist beim filtern der, ich weiß nicht, wie Datums-filter im UK-format.

Ein anderes problem das ich habe ist, dass es keinen datetime-Typ, nur das Datum, so kann nur filtern von Daten, die nicht datetimes.

Jede Hilfe oder Ideen würde geschätzt.

Dies ist die Teilansicht (cshtml)

<script type="text/javascript">
$(document).ready(function() {
    var date = new Date();
    var dateString = date.getMonth()+1 + "/" + date.getDate() + "/" + date.getFullYear();
    var url = '@Url.Action(AccountTypeController.GetAllocationGridData, new {id = Model.Id})';

    var dataSource = new kendo.data.DataSource({
        serverPaging: true,
        serverSorting: true,
        serverFiltering: true,
        pageSize: 10,
        transport: {
            read: {
                type: 'post',
                dataType: 'json',
                url: url
            },
            parameterMap: function(options) {
                if (options.filter) {
                    for (var i = 0; i < options.filter.filters.length; i++) {
                        if (options.filter.filters[i].field == 'Start' || options.filter.filters[i].field == 'End') {
                            options.filter.filters[i].value = kendo.toString(options.filter.filters[i].value, "MM/dd/yyyy");
                        }
                    }
                }
                return options;
            }
        },
        schema: {
            data: 'Data',
            total: 'Count',
            model: {
                id: 'Id',
                fields: {
                    Id: { type: 'number' },
                    Start: { type: 'date' },
                    End: { type: 'date' },
                    Allocation: { type: 'number' }
                }
            }
        },
        sort: {
            field: "Start",
            dir: "asc"
        },
        filter:{
            logic: "and",
            filters: [
                {
                    field: "End",
                    operator: "gt",
                    value: dateString
                }
            ]
        }
    });

    $('#account-allocation').kendoGrid({
        height: 383,
        dataSource: dataSource,
        columns: [
            {
                field: 'Start',
                title: 'Start Date',
                template: '#= kendo.toString(Start,"dd/MM/yyyy HH:mm") #'
            },
            {
                field: 'End',
                title: 'End Date',
                template: '#= kendo.toString(End,"dd/MM/yyyy HH:mm") #'
            },
            {
                field: 'NoSpaces',
                title: 'Number of Spaces',
                filterable: false
            },
            {
                field: 'Id',
                filterable: false,
                title: 'Actions',
                template: '<a class="link-lightbox" href="@Url.Action(AccountTypeController.UpdateAllocationAction1, AccountTypeController.Name)/#= Id #"><img src="@Url.Content("~/Content/img/grid-update.png")" alt="Update"/></a>',
                width: 75
            }
        ],
        filterable: true,
        sortable: false,
        scrollable: false,
        pageable: true          
    });
</script>

<div class="panel panel-w">
    <h2>@Model.Name Allocations
            <a href="@Url.Action(AccountTypeController.SetAllocationAction1, new { id = Model.Id })" class="button link-lightbox"><span class="edit">Set Account Type Allocation</span></a>
    </h2>
    <div id="account-allocation"></div>
</div>
Schreibe einen Kommentar