Ticket T1279240
Visible to All Users

Displaying Top N Records in DevExtreme dxPivotGrid

created a day ago

Hello DevExpress Team,

I would appreciate your guidance on how to display only the Top N records based on the row area fields in DevExtreme dxPivotGrid. If there is a recommended approach or built-in functionality for this, I would be grateful for your advice.

For additional context, please refer to my previous discussion DevExtreme PivotGrid with large datasets
Thank you for your time and support.

Best regards,
Hisham

Answers approved by DevExpress Support

created 14 hours ago (modified 14 hours ago)

Hello,

While PivotGrid doesn't have the built-in TOP N feature, there are custom solutions we can share. The solution primarily depends on your data binding logic. Therefore, I reviewed the initial ticket first. Based on my understanding, you chose to aggregate data on the server.

In this usage scenario, it's necessary to create a custom filter expression to filter out data. To do this, make a query to get unique values for required fields (e.g., in LINQ). Then, create a string filter expression that will only include the first N fields (e.g., [["Field1", "=", "A"], "or", ["Field1", "=", "B"], "or", ["Field1", "=", "C"]]). If you implement this logic in C# before you render a view, you can pass the resulting filter to PivotGrid's DataSource|Filter.

Please keep in mind that the exact implementation will depend on your backend and data fetching specifics. Solutions can vary in complexity depending on queries you aim to support. We can only share general recommendations for implementing custom query logic for a backend application.

Thanks,
Artem

    Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

    Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.