Disable multiple ajax requests sent by Kendo Grid

2 posts, 0 answers
  1. Niloofar
    Niloofar  avatar
    24 posts
    Member since:
    Jan 2015

    Posted 29 Mar 2016 Link to this post

    As its shown below, i'm overriding my read function in transport to send ajax request to get data and set it as datasource for the grid but i also have server side paging enabled with virtual scrolling. But i have noticed that i see instead of one, multiple requests(at least two) were sent. I read the posts and people are talking about prefetch and fetch issue. Is there any good solution sofar to fix this issue in my case.
     
    var dataSource = {
        transport: {
            read: function (options) {
                var success = function (response) {
                    options.success(response);
                };
     
                var error = function (xhr, status, error) {
                    Ember.Logger.error('Fail response: ' + xhr.responseText + ' (status=' + xhr.status + ' ' + error + ')');
                };
                _this.get('PopulateGridData')(gridUrl, success, error, options.data, 'POST', true, true);
            },
        },
        pageSize: gridPageSize,
        schema: gridSchema,
        serverPaging: true,
        serverSorting: true,
        serverGrouping: true,
        serverFiltering: true,
    };
     
    var gridOptions = {
        dataSource: dataSource,
        columns: gridColumns,
        editable: gridEditable,
        pageable: {
            refresh: true,
            numeric: false,
            previousNext: false,
        },
        height: gridHeight,
        scrollable: {
            virtual: true,
        },
        groupable: true,
        filterable: true,            
    };
     
    var grid = Ember.$("#kendo-grid").kendoGrid(gridOptions).data('kendoGrid');
     
    _this.set('kendoGrid', grid);
  2. Nikolay Rusev
    Admin
    Nikolay Rusev avatar
    2289 posts

    Posted 01 Apr 2016 Link to this post

    Hello Niloofar,

     

    As it seems you've already have found the information about how virtualization works, i.e it pre-fetches data in order to achieve more smooth scrolling experience. You could not disable these request as they are integral part of the implementation.

     

    Regards,
    Nikolay Rusev
    Telerik
     
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
     
Back to Top