Kendo Grid Data source event

2 posts, 0 answers
  1. Tomasz
    Tomasz avatar
    1 posts
    Member since:
    Mar 2014

    Posted 28 Mar 2014 Link to this post

    Hi,

    I have the following kendo grid in my page:

    @(Html.Kendo().Grid<Di.Service.Tracking.Models.DomainObjects.DTrackingFileEvent>()
     .Name("fileAuditing")
     .Columns(columns =>
    {
    columns.Bound(c => c.IsError);
    columns.Bound(c => c.EventDateTime).Title(@Di.Nls.Label.Event_Date_Time);
    columns.Bound(c => c.Details).Title(@Di.Nls.Label.Details);
    columns.Bound(c => c.Description).Title(@Di.Nls.Label.Description);
    columns.Bound(c => c.Result).Title(@Di.Nls.Label.Result);
    })
    .ClientRowTemplate(
    "<tr bgcolor=#:IsError ? 'Pink' : 'White'# data-uid='#: uid #'>" +
      "<td>" +
      "# if(IsError == true) {# " +
    "<img src='/Images/FileState/Error.gif' />" +
    "#} else {# " +
    "<img src='/Images/FileState/Ok.gif' />" +
    "#}#" +
      "</td>" +
      "<td>#: EventDateTime #</td>" +
      "<td>#: Details #</td>" +
      "<td>#: Description #</td>" +
      "<td>#: Result #</td>" +
    "</tr>"
    )
    .DataSource(dataSource => dataSource
    .Ajax()
    .Model(model => model.Id(p => p.ID))
    .Read(read => read.Action("FileAuditingDetails", "FileDetails", new { iFileID = iFileID }))
    .Events(e=>e.RequestEnd("onRequestEnd"))
    )
    )

    <script>
    function onRequestEnd(e) {
      //do something with event date time
    }
    </script>

    My goal is to format the "Event date time" column so it provides a value based on the user time zone info. In order to do that I wanted to handle the "requestEnd" event, but when I do that I cannot see any data on the grid.

    Removing the following line .Events(e=>e.RequestEnd("onRequestEnd")) load all the data correctly.

    Any ideas how to achieve my goal?
  2. Alexander Popov
    Admin
    Alexander Popov avatar
    1444 posts

    Posted 01 Apr 2014 Link to this post

    Hi Tomasz,

    I would recommend checking this Code Library project, where similar behavior is illustrated.

    Regards,
    Alexander Popov
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

Back to Top