Update on IE is different from FireFox

5 posts, 0 answers
  1. Paul
    Paul avatar
    8 posts
    Member since:
    Aug 2012

    Posted 13 Sep 2012 Link to this post

    Hi,

    I'm kinda new to Kendo UI so its possible I've missed it in the discussions here.

    We're building a PoC with Kendo UI and MVC3 in Visual Studio 2010. What I noticed today is that an 'inline' edit in the Kendo Grid leads to different results in IE9 and FireFox. When I edit a line in IE9, update it to the server the data is persisted correctly in the DB and the screen show the new value. After a refresh however the old data is back. Closing IE9 all together and restarting the App gives me the data from DB correctly.

    If I do the same in FireFox after a refresh the data is shown correctly.

    When I empty the cache in IE9 before the refresh the behavior is as expected (showing the correct information from the DB).

    Here's some of my code:
    The Update Method in the Controller
    public HttpResponseMessage Update(int id)
    {
        HttpResponseMessage response = new HttpResponseMessage();
     
        using(var entity = VMProjectRegel.GetById(this, Id))
        {
            entity.Aantal = Convert.ToInt32(Request["Aantal"]);
            entity.Prijs = Convert.ToDecimal(Request["Prijs"]);
            entity.BTW = Convert.ToDecimal(Request["BTW"]);
            entity.CreatedOn = Convert.ToDateTime(Request["CreatedOn"]);
            entity.CreatedBy = Convert.ToInt32(Request["CreatedBy"]);
            entity.ChangedOn = Convert.ToDateTime(Request["ChangedOn"]);
            entity.ChangedBy = Convert.ToInt32(Request["ChangedBy"]);
     
            ORMSession.SaveChanges();
     
            response.StatusCode = HttpStatusCode.OK;
        }
     
        return response;
    }

    The view:
    <script src="@Url.Content("~/DataSources/ProjectOnderhoudDataSource.generated.js")" type="text/javascript"></script>
    <div id="projectEditForm">
        <input id="DatumAanvang" data-bind="value: selectedProject.DatumAanvang" />
        <hr />
        <div id="projectRegelGrid" />
        <script type="text/javascript">
            $(function ()
            {
                $("#DatumAanvang").width(220).kendoDatePicker();
     
                ProjectOnderhoudDataSource.bind("change", function (data)
                {
                    ProjectOnderhoudViewModel.set("selectedProject", this.view()[0]);
                });
     
                ProjectOnderhoudDataSource.read();
     
                kendo.bind($("#projectEditForm"), ProjectOnderhoudViewModel);
     
                ProjectOnderhoudProjectRegelListDataSource.options.transport.read.parentId = 1;
     
                $("#projectRegelGrid").kendoGrid
                ({
                    columns:
                    [
                        { field: "Aantal", title: "Aantal" },
                        { field: "Prijs", title: "Prijs" },
                        { field: "BTW", title: "BTW" },
                        { field: "CreatedOn", title: "Datum aangemaakt", template: '#= kendo.toString(CreatedOn, "dd MMMM yyyy") #' },
                        { field: "ChangedOn", title: "Datum gewijzigd", format: "{0:dd MM yyyy}" },
                        { command: ["edit", "destroy"], title: " ", width: "210px" }
                    ],
                    editable: "inline",
                    deletabled: true,
                    pageable: true,
                    sortable: true,
                    dataSource: ProjectOnderhoudProjectRegelListDataSource,
                    pageSize: 3,
                    serverPaging: false
                });
            });
        </script>
    </div>


    Regards
    Paul.
  2. Daniel
    Admin
    Daniel avatar
    2230 posts

    Posted 18 Sep 2012 Link to this post

    Hello Paul,

    Most likely the result of the Grid action is being cached. Please check if specifying in the DataSource transport request configuration that caching should not be used resolves the problem e.g.

    transport: {
        update: {
            url: "url",
            cache : false
        },
    Kind regards,
    Daniel
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  3. Phil
    Phil avatar
    30 posts
    Member since:
    Aug 2012

    Posted 27 Sep 2012 Link to this post

    Do you have any simliar guidance for those of us using the kendo MVC controls?  There is no 'cache' parameter that i can find in the grid control it seems.
  4. Daniel
    Admin
    Daniel avatar
    2230 posts

    Posted 02 Oct 2012 Link to this post

    Hello Phil,

    Currently specifying the cache request option is not supported by the Kendo DataSource for MVC. You can prevent the browser caching by using the OutputCache attribute on the action that should not be cached e.g.

    [OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
    public ActionResult Read([DataSourceRequest] DataSourceRequest request)
    {
        return Json(data.ToDataSourceResult(request));
    }
    Regards,
    Daniel
    the Telerik team
    Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
  5. Phil
    Phil avatar
    30 posts
    Member since:
    Aug 2012

    Posted 04 Oct 2012 Link to this post

    That does fix the issue for me.  Thanks!
Back to Top