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

It takes a long time before sending request to server side

1 Answer 132 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Lao
Top achievements
Rank 1
Lao asked on 03 Jul 2015, 10:02 PM

I'm trying to read data from server side and fill in to the grid, it's about 50,000 rows.

I'm using Spring MVC, it always takes 5~9 seconds between "return 'index'" and receiving the "read" request from index.jsp, and it'll take a little shorter after the first loading of grid, but also more than 3 seconds every time.

My controller code is like this: (the time is between time1 and time2)

@RequestMapping(method={RequestMethod.GET})
public String index(Model model) {
 
    // time1
    return "index";
}
 
@RequestMapping(value="list", method={RequestMethod.GET})
@ResponseBody
public String list(Model model) {
  
    // time2
    ...
}

 

The related dataSource code is like:

var dataSource1 = new kendo.data.DataSource({
        transport: {
            read: { url: "${listUrl}", dataType: "json" },
            create: { url: "${createUrl}", dataType: "json", type: "post" },
            update: { url: "${updateUrl}", dataType: "json", type: "post" },
            parameterMap: function(options, operation) {
                return {
                    category: category,
                    queryType: queryType.value(),
                    models: kendo.stringify(options.models)
                }
            }
        },
        batch: true,
        pageSize: 20,
        schema: {
            model: {
                id: "id",
                fields: {
                    id: { type: "number", editable: false },
                    on: { type: "string" },
                    ln: { type: "string", validation: { required: true } }
                }
            }
        },
        requestEnd: onRequestEnd
    });
 
    $("#grid1").kendoGrid({
        dataSource: dataSource1,
        pageable: true,
        height: 550,
        toolbar: ["create"],
        columns:
        [{
            field: "id", title: "ID", width: "80px",
            filterable: {
                ui: function(element) {
                    element.kendoAutoComplete({
                        dataSource: dataSource1,
                        dataTextField: "id"
                    });
                }
            }
        },{
            field: "on", title: "Operating Name", width: "320px",
            filterable: {
                ui: function(element) {
                    element.kendoAutoComplete({
                        dataSource: dataSource1,
                        dataTextField: "on"
                    });
                }
            }
        },{
            field: "ln", title: "Legal Name", width: "320px",
            filterable: {
                ui: function(element) {
                    element.kendoAutoComplete({
                        dataSource: dataSource1,
                        dataTextField: "ln"
                    });
                }
            }
        },{
            command: ["edit"], title: " ", width: "200px"
        }],
        editable: "inline",
        filterable: {
            extra: false,
            operators: {
                number: {
                    eq: "Is equal to",
                    gt: "Greater than",
                },
                string: {
                    startswith: "Starts with",
                    contains: "Contains",
                }
            }
        },
    });
 
var dataSource2 = new kendo.data.DataSource({
        transport: {
            read: { url: "${listUrl}", dataType: "json" },
            create: { url: "${createUrl}", dataType: "json", type: "post" },
            update: { url: "${updateUrl}", dataType: "json", type: "post" },
            parameterMap: function(options, operation) {
                return {
                    category: category,
                    queryType: queryType.value(),
                    models: kendo.stringify(options.models)
                }
            }
        },
        batch: true,
        pageSize: 20,
        schema: {
            model: {
                id: "id",
                fields: {
                    id: { type: "number", editable: false },
                    desc: { type: "string", validation: { required: true } }
                }
            }
        },
        requestEnd: onRequestEnd
    });
 
    $("#grid2").kendoGrid({
        autoBind: false,
        dataSource: dataSource2,
        pageable: true,
        height: 550,
        toolbar: ["create"],
        columns:
        [{
            field: "id", title: "ID", width: "80px",
            filterable: {
                ui: function(element) {
                    element.kendoAutoComplete({
                        dataSource: dataSource2,
                        dataTextField: "id"
                    });
                }
            }
        },{
            field: "desc", title: "Description", width: "840px",
            filterable: {
                ui: function(element) {
                    element.kendoAutoComplete({
                        dataSource: dataSource2,
                        dataTextField: "desc"
                    });
                }
            }
        },
        {
            command: ["edit"], title: " ", width: "200px"
        }
        ],
        editable: "inline",
        filterable: {
            extra: false,
            operators: {
                number: {
                    eq: "Is equal to",
                    gt: "Greater than",
                },
                string: {
                    startswith: "Starts with",
                    contains: "Contains",
                }
            }
        },
    });

 

Please help me to find the reason, Thanks!

 

 

1 Answer, 1 is accepted

Sort by
0
Alexander Popov
Telerik team
answered on 07 Jul 2015, 02:34 PM
Hi Lao,

Would you please share more details about the scenario? For example, how long does it take to load all the scripts and when is the document.ready event triggered? Basically, there is nothing in the Grid's or DataSource's code that would take so long for a Read request to be sent. This should happen instantaneously, so I suspect that there is something else that takes too long. Sharing a runnable project, live link or a video would help us investigate. 

Regards,
Alexander Popov
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
Lao
Top achievements
Rank 1
Answers by
Alexander Popov
Telerik team
Share this question
or