Pivot Grid, Column Values Populated When No Column Selected/Listed

1 Answer 174 Views
PivotGrid
Gedalya
Top achievements
Rank 1
Gedalya asked on 15 Sep 2021, 06:06 PM

I am currently working with the Pivot Grid; its quite nice. I have noticed though that if the Column is removed, the grid itself still retains data and formatting unique to that column. Using the demo as an example:
https://demos.telerik.com/jsp-ui/pivotgrid/index

The default columns are:

[Date].[Calendar] and [Product].[Category]

The default measure is:

[Measures].[Reseller Freight Cost]

If you remove all three of the above, both column fields and the measure, the resulting PivotGrid will still reflect a financial amount even though only a Row is populated with a Field.

See screen shot:

This is confusing to me and my users; why is it working this way? Is it possible to change this behavior?

1 Answer, 1 is accepted

Sort by
1
Nikolay
Telerik team
answered on 20 Sep 2021, 09:22 AM

Hello Gedalya,

This behavior is by design. Rows and measures are shown in the PivotGrid disregarding the available columns. This, however, can be worked around with custom logic in the dataBound event handler:

dataBound: function(e) {
              var pivotgrid = e.sender;
              if (pivotgrid.dataSource._columns.length === 0) {
                  $(".k-grid-content").find("tr").hide();
                  $(".k-grid").find("tr").hide();
              } else {
                $(".k-grid-content").find("tr").show();
                $(".k-grid").find("tr").show();
              }
            }

Here is a Dojo demo I prepared demonstrating this:

Let me know if you have any questions.

Regards,
Nikolay
Progress Telerik

Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.

Tags
PivotGrid
Asked by
Gedalya
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
Share this question
or