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

Update on IE is different from FireFox

4 Answers 92 Views
Data Source
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 13 Sep 2012, 09:54 AM
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.

4 Answers, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 18 Sep 2012, 10:22 AM
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!
0
Phil
Top achievements
Rank 1
answered on 27 Sep 2012, 05:11 PM
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.
0
Daniel
Telerik team
answered on 02 Oct 2012, 11:37 AM
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!
0
Phil
Top achievements
Rank 1
answered on 04 Oct 2012, 02:20 PM
That does fix the issue for me.  Thanks!
Tags
Data Source
Asked by
Paul
Top achievements
Rank 1
Answers by
Daniel
Telerik team
Phil
Top achievements
Rank 1
Share this question
or