This is a migrated thread and some comments may be shown as answers.

Grid Data refresh

1 Answer 746 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Erik
Top achievements
Rank 1
Erik asked on 13 Oct 2012, 12:22 PM

Hi

I am new to Kendo ui and have created a MVC page with a very simple Grid

@Html.Kendo().Grid(Model).Name("kendoGrid").Columns(columns =>

    {

        columns.Bound(p=>p.Id).Width(50);

        columns.Bound(p => p.name);

        columns.Bound(p => p.Date);

        columns.Bound(p => p.time);

        columns.Command(command => { command.Custom("Details").Text("Details").Action("Edit", "Booking"); }).Width(100);

           

    }).Sortable().Scrollable().DataSource(dataSource => dataSource.Server()

        .Model(model => model.Id(p => p.Id))                        

    ).HtmlAttributes(new{Style ="height: 100%"})

My question is what is the best way to refresh the grid data every 1min. whiteout reloading the whole page.

1 Answer, 1 is accepted

Sort by
0
Accepted
David
Top achievements
Rank 1
answered on 14 Oct 2012, 01:08 AM
Well you can use Javascript standard set interval method to refresh your grid like this

$(document).ready(function()
{
    var refreshId = setInterval( function()
    { //GET YOUR GRID REFERENCE
        var grid = $("#gridID").data("kendoGrid"); //USE FILTER METHOD OF GRID HERE IF YOU WANT TO REFRESH IT WITH SOME PARAMETERS $filter.push({ field: "gridColumnName", operator: "eq", value: field.value }); grid.dataSource.filter($filter); //ANOTHER WAY IS TO JUST REFRESH GRID grid.dataSource.read();
    }, 5000);
});

Tags
Grid
Asked by
Erik
Top achievements
Rank 1
Answers by
David
Top achievements
Rank 1
Share this question
or