James
James

Reputation: 3184

How do I use a Kendo UI grid with server side paging and search form?

I have a Kendo UI grid. The grid is built but not displayed on the page until a search form is submitted and a response is returned by the server. The response could result in a large number of rows (depending on the search parameters), so serverPaging is set to true.

The transport property in the dataSource object is set.

For example:

$('#resultsGrid').kendoGrid({
    dataSource: {
        pageSize    : 10,
        serverPaging: true,
        schema      : {
            total: 'total'
        },
        transport   : {
            read: {url: '../search.x'}
        }
    }
    /*... more options*/
});

However, an AJAX call (to ../search.x) is made to the server when the pages loads. How can I have the AJAX call be made when the search form is submitted and prevent it being called when the page loads? Also, how can I have transport read call the server with the original POST parameters of the search form when the next/previous page of results is requested?

Upvotes: 0

Views: 5484

Answers (1)

OnaBai
OnaBai

Reputation: 40917

Set autoBind to false in the Grid initialization. Documentation here


autoBind Boolean(default: true)

If set to false the widget will not bind to the data source during initialization. In this case data binding will occur when the change event of the data source is fired. By default the widget will bind to the data source specified in the configuration.

Upvotes: 1

Related Questions