Reputation: 15378
I have this code in my controller controller:
List<TResult> list = db.GetBigData();
return PartialView("GridViewPartialView", list);
View:
@Html.DevExpress().GridView(
settings =>
{
settings.Name = "gvGrouping";
settings.CallbackRouteValues = new { Controller = "Display", Action = "GridViewPartialView" };
settings.SettingsBehavior.AllowSort = false;
settings.Width = System.Web.UI.WebControls.Unit.Percentage(100);
settings.SettingsPager.Visible = false;
//create many column
settings.Settings.ShowGroupPanel = true;
};
}).Bind(Model).GetHtml()
On the first run, the controller executes the GetBigData
method. The view shows, but all the nodes are collapsed. If I click a node, it will callback to the controller which again will create a new query to the database. The same thing happens with sorting. I do not want there to be a request to the database every time, so how can I avoid the callback?
Upvotes: 1
Views: 3315
Reputation: 4143
GridView is a server side control which performs all data calculations on the server and sends only a tiny portion to the client. Since the client side doesn't have all data available, it cannot re-sort or re-group it when necessary. It sends a callback to the server instead.
All you can do is to speed up callback. First thing you should do is enable server-mode which will greatly reduce amount of data transfered from the database. Here is how you can enable it: http://documentation.devexpress.com/#AspNet/CustomDocument3726
Upvotes: 3