I am presenting the user with a text box in which they can enter a search term. When the search term changes I call the following script.
Let's say the original search term causes 10 pages to be displayed and that we are viewing page 10. So we are viewing, 190 of 200. And let's say the new search term only produces 100 items, what happens is that the grid is empty and the bottom line indicates we are viewing 190 of 100. Refreshing the grid corrects the problem, but I added the line "grid.dataSource.page(1);" above to do this automatically. But I have observed that this has the side effect of calling the Controller twice. Generally, I used grid.dataSource.read() to refresh the grid. So I am wondering what is the correct way to perform this operation so that I don't make two calls to the database. I guess that every time the grid is changed it updates. Is there a way to turn updating off, make changes to the grid, and then refresh it.
function
fillGrid() {
var
grid = $(
"#Grid"
).data(
"kendoGrid"
);
$(
"#ActionError"
).html(
""
);
grid.dataSource.page(1);
grid.dataSource.read();
}