Comments (8)
To implement total summary caching you can use the following code in the onBeforeSend handler:
onBeforeSend: (function() {
var lastFilter;
return function(method, ajaxOptions) {
var data = ajaxOptions.data;
if(data.totalSummary) {
var currentFilter = data.filter || null;
if(lastFilter !== undefined && lastFilter === currentFilter) {
delete data.totalSummary;
}
lastFilter = currentFilter;
}
};
})()
from devextreme.aspnet.data.
There are no plans to add such caching capabilities to dxDataGrid in the near future (however, the team is aware of your use case and will track similar inquiries).
Consider another approach. It's possible to implement a custom caching store in JavaScript (see What Are Stores and CustomStore API reference) which will sit between the grid and the store provided by this library. Inside it, you'll be able to code any logic of caching and modifying web requests and responses, instead of relying upon undocumented behaviors.
from devextreme.aspnet.data.
This library implements a RESTful stateless protocol. If the grid asks for totals then we calculate them. Summary caching is an interesting idea, I'll share it with the team who works on dxDataGrid.
Technically, you may strip summary-related parameters from a request by handling onBeforeSend, based on some custom state. After a quick look, I expect that dxDataGrid keeps existing summaries if they are absent from the response. However, haven't checked it.
If I'm not mistaken, you're using EF Core which currently doesn't translate GroupBy
to SQL. If it did then repeated aggregates would be cached on the database level and wouldn't present a problem.
If it's the case, I suggest that you leave your feedback in dotnet/efcore#2341. It might help prioritize GroupBy
support.
/cc @vconst
from devextreme.aspnet.data.
P.S. There is another possibility for .NET Core - to issue multiple aggregate queries, one per total summary item instead of a single GroupBy
. It could be a good trade-off.
from devextreme.aspnet.data.
Actually we're using a custom made Linq Provider based on Remotion.Linq.SqlBackend and we already added support for the "RemoteGrouping" feature.
So thanks for the hint stripping parameters in the onBeforeSend event. Maybe this can be an extension of the cliend side js library.
from devextreme.aspnet.data.
Interesting. With GroupBy
being translated to SQL and database query caching in action, can you say that querying for totals on each request has a noticeable impact on performance?
from devextreme.aspnet.data.
With our demo database and displaying "all" records (not filtered to any criteria) the querying for totals takes up to 2 seconds (table contains ~2million records). But this is not representativ because the data set is much smaller when using in production.
from devextreme.aspnet.data.
Thanks @vconst. Is this possible to implement this as default behaviour of the grid or provide an "extension" method for this?
I've extended the sample to remove the requireTotalCount also.
Unfortunately due this "hack", the grid creates a seconds request with "IsCountQuery" to retrieve the count value. Is there an option that the grid remembers the total count value the same way it remembers the total summaries? Or is there a way to inject a value after the request returns from the server?
from devextreme.aspnet.data.
Related Issues (20)
- XPO: NRE in a filter by an associated object
- .net core support HOT 2
- Allow to modify loadParams at any time HOT 1
- Support SmartEnums
- DataSourceLoadOptionsBase - provide option to skip StringToLower for specific fields HOT 2
- Avoid lifting to nullable HOT 3
- Licensing HOT 3
- How to pass allowdiskuse query parameter for mongodb with the DataLoader? HOT 2
- DataSourceLoadOptions don't work with .NET 6's minimal API HOT 1
- AvgAggregator and RemoteAvgAggregator not using IEnumerable Average() HOT 4
- An exception is thrown when Enum values are compared HOT 1
- Client-side script: If an error is thrown in a Deferred callback, this error doesn't appear in the console, which makes debugging more difficult HOT 1
- ES6 support
- Update 'Using CI Builds'
- Building the /net/Samples/Sample.csproj fails because of missing 'node_modules' directory. HOT 1
- Dependency Dashboard
- ExpressionCompiler fails with AmbiguousMatchException when a source contains a class with an overridden base property with other data types
- IsSummaryQuery Implementation Hidden
- Nested Datagrid Excel Export HOT 2
- Provide additional parameters to support provision of execution context to Load and LoadAsync HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from devextreme.aspnet.data.