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

paging problem

3 Answers 51 Views
Grid
This is a migrated thread and some comments may be shown as answers.
fabien
Top achievements
Rank 1
fabien asked on 23 Jun 2014, 03:13 PM
Hi,
I use the KendoGrid to display some data returned by a MVC3 crontroller.
Data are successfully displayed, but the kendoGrid's pager display "Page 0 of NaN"

Here is my JS: 

        var sectionId = $("#myKendoCombobox").val();
        $("#myKendoDiv").kendoGrid({
            scrollable: true,
            sortable: true,
            pageable: true,
            selecteable: false,
            filterable: true,
            dataSource: {
                    transport: {
                        read: {
                            url: _pathRoot + "GetDataById",
                            data: { sectionId: sectionId },
                            dataType: "json",
                            type: "GET",
                            contentType: "application/json; charset=utf-8"
                        }
                    },
                    schema: {
                        data: "data",
                        total: "total"
                        },
                    pageSize: 1,
            },

            pageable: {
                refresh: true,
                input: true,
                numeric: false
            },       
           columns: [ ... ]
        });


I tried to use un function for the "total" parameter, like this :                         total: function (response) {
                            alert(response.total);
                            return response.total;
                        }
And the message box successfully display my number of items, so it's not a problem of proprty name.

Could you help me to fix that problem ?
Thanks in advance.







3 Answers, 1 is accepted

Sort by
0
Dimo
Telerik team
answered on 25 Jun 2014, 12:33 PM
Hello Fabien,

Have you verified that the returned JSON matches the schema? Can you paste here the server response?

Regards,
Dimo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
0
fabien
Top achievements
Rank 1
answered on 25 Jun 2014, 12:42 PM
Hi, thanks for your reply:

Here is the response (with Chrome developper Tool)
Object {total: 3, data: Array[3]}

In data:
Array[3]:
0: Object => Nom: "Test1" SectionId: 2 Sens: "Envoi" Type: "ProviderMSMQ"
1: Object => Nom: "Test2" SectionId: 2 Sens: "Envoi" Type: "ProviderMSMQ"
2: Object => Nom: "Test3" SectionId: 2 Sens: "Envoi" Type: "ProviderMSMQ"

Since yesterday, i put the model, like this, but it still dont paginate:
                            model: {
                                fields: {
                                    SectionId: { type: "number" },
                                    Nom: { type: "string" },
                                    Type: { type: "string" },
                                    Sens: { type: "string" }
                                }
                            }
0
Dimo
Telerik team
answered on 27 Jun 2014, 08:36 AM
Hello Fabien,

Judging by the provided information, I am still not sure that the returned JSON is in the correct format. Please compare your implementation and server response with the following example, which also uses JSON:

http://jsfiddle.net/dimodi/CHUUx/1/show/

Regards,
Dimo
Telerik
 
Join us on our journey to create the world's most complete HTML 5 UI Framework - download Kendo UI now!
 
Tags
Grid
Asked by
fabien
Top achievements
Rank 1
Answers by
Dimo
Telerik team
fabien
Top achievements
Rank 1
Share this question
or