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

Grid not displayed right after returning to the page through browser "back" button.

1 Answer 73 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Elena
Top achievements
Rank 1
Elena asked on 07 Nov 2012, 12:48 PM
I have a grid, that works fine, when page gets through address or postback.
But if I load the page with the grid, go somewhere to other page, then return to th grid page through "Back" button in the browser, then the grid will display, populates with data, but all the columns and schema are lost.
It display all the columns (when only 5 of then should be displayed), type in the schema is not applied (date fileds are displayed as /Date12345... format) and no tempate are aplied to the fields where these templates are defined.

Help me please, this ruins my site!
I've tried to read data again with dataSource "read" method - everything the same.
If I press "F5", then grid will display normally.

Here is the code:
    $(document).ready(function () {


        var dataSource = new kendo.data.DataSource({
                transport: {
                    read: {
                        url: "Courses.aspx",
                        contentType: "application/json",
                        dataType: "json",
                        cache:false
                    }
                },
                schema: {
                    data: "List", 
                    total: "Total",
                    model: {
                        id: "ID",
                        fields: {
                             CourseVersionName: {
                                editable: false,
                                nullable: true
                             },
                             CourseName: {
                                editable: false,
                                nullable: true
                             },
                             CourseLanguage: {
                                editable: false,
                                nullable: true
                             },
                             Country: {
                                editable: false,
                                nullable: true
                             },
                             LastLoad: {
                                type: "Date",
                                editable: false,
                                nullable: true
                             },
                             QuestionsCount: {
                                editable: false,
                                nullable: true
                             },
                             ExpirationDate: {
                                type: "Date",
                                editable: false,
                                nullable: true
                             }
                        }
                    }
                },
                pageSize: 5,
                serverPaging: true 
            });


        $("#dataGrid").kendoGrid({
            dataSource: dataSource,
            columns: [
                { field: "CourseVersionName", title: "Course Version" },
                { field: "CourseName", title: "Course Name" },
                { field: "CourseLanguage", title: "Language" },
                { field: "Country", title: "Country" },
                { field: "LastLoad", title: "Course Loaded Date", sortable: true, template: '#=kendo.format("{0:dd.MM.yyyy}", LastLoad)#' },
                { field: "QuestionsCount", title: "Questions", template: '<a href="Questions.aspx?CourseID=${ ID }">Questions (${ QuestionsCount })</a>' },
                { field: "ExpirationDate", title: "Expiration Date", sortable: true, template: '#= ExpirationDate != null ? kendo.format("{0:dd.MM.yyyy}", ExpirationDate) : ""#' }
                ],
            autoBind : false,
            pageable: true
       });


       dataSource.read();

1 Answer, 1 is accepted

Sort by
0
Jorge
Top achievements
Rank 1
answered on 16 Nov 2012, 07:08 PM
I have seen this same issue.
Tags
Grid
Asked by
Elena
Top achievements
Rank 1
Answers by
Jorge
Top achievements
Rank 1
Share this question
or