Skip to content Skip to sidebar Skip to footer

Kendo Grid Refresh Issue In Mobile

I refresh the kendo grid for every 10 seconds, I used following code and I used the kendo.all.min.js $(document).ready(function () { loadData(); intervalMa

Solution 1:

@gitsitgo 's comment, I changed the code as following way, for avoid the re initialization of the grid, and now its working fine.

var myDataSource = new kendo.data.DataSource({
        data: [
                        { ID: '1001', FirstName: 'Alphy', LastName: 'LastName', category: 'A', Markable: true },
                        { ID: '1002', FirstName: 'Betty', LastName: 'LastName', category: 'B', Markable: true },
                        { ID: '1003', FirstName: 'Betty', LastName: 'LastName', category: 'B', Markable: true}],
        schema: {
            model: {
                fields: {
                    FirstName: { type: "string" },
                    LastName: { type: "string" }
                }
            }
        },
        sort: {
            field: "FirstName",
            dir: "asc"
        },
        pageSize: 10
    });

    $(document).ready(function () {
        initGrid();
        loadData();
        intervalManager(true, TableStatus, 10000);            
    });
    varTableStatus = function () {
        loadData();
    }
    var refreshorderplacedgrid;
    functionintervalManager(flag, animate, time) {
        if (flag)
            refreshorderplacedgrid = setInterval(animate, time);
        elseclearInterval(refreshorderplacedgrid);
    }
    functionloadData() {
        $("#grid").data("kendoGrid").setDataSource(myDataSource);
        $("#grid").data("kendoGrid").refresh();
    }
    functioninitGrid() {
        var grid = $("#grid").kendoGrid({
            dataSource: myDataSource,
            scrollable: true,
            sortable: true,
            selectable: true,
            columns: [
            {
                field: "FirstName",
                title: "First Name"
            },
            {
                field: "LastName",
                title: "Last Name"
            },
            { template: kendo.template($("#isCancel-template").html()) }
        ]
        }).data("kendoGrid");
    }

Thanks, Guna

Post a Comment for "Kendo Grid Refresh Issue In Mobile"