Author Topic: Show columns in pivot mode  (Read 2806 times)

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Show columns in pivot mode
« on: November 20, 2018, 09:56:09 am »
Hello Team,

Our requirement is to show some more columns in the pivot mode.

So how to add columns in the pivot mode for show. In hide Cols menu also some columns are not showing. In normal mode we are able to show and hide columns.

For Example we have one department column but we are not able to see that column in the pivot mode. We created plnkr for your understanding. Refresh if not load properly.

Plnkr URL:
https://next.plnkr.co/edit/Zzj3Z2PtGO9am8A3

Please give your valuable suggestion.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Show columns in pivot mode
« Reply #1 on: November 20, 2018, 05:59:23 pm »
Pivot mode has different columns ( colModel ) than original columns ( colModel ) and it retains only the relevant columns from original view.
Retaining other columns don't make sense in the pivot view context.

pivotCM event can be used to add custom columns in the pivot view.

Code: [Select]
pivotCM: function(evt, ui) {
      ui.CM.push(collM[2]);
}   

https://next.plnkr.co/edit/ZPx1bbU5tlnPWfY5

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Re: Show columns in pivot mode
« Reply #2 on: November 22, 2018, 09:25:58 am »
Hello Team,

Thanks for your valuable solution.

According to your suggestion we are able to show the department column. But seems data is not showing for the department column plnkr shared by you.

I tried to get data using :

var data = $('#grid_Pivot').pqGrid('option','dataModel.data');

In dataModel also data is not showing for Department column.

Please suggest further.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Show columns in pivot mode
« Reply #3 on: November 22, 2018, 09:34:37 pm »
pivot uses the data from row group by, column group by and aggregate columns and transforms to summarize it.

Any other column data doesn't make any sense in the pivot context.

If you need to include data from Department or any other column, then you have to include it in row group by or column group by columns.

EPM Solutions

  • Pro Ultimate
  • Full Member
  • *
  • Posts: 182
    • View Profile
Re: Show columns in pivot mode
« Reply #4 on: November 28, 2018, 12:00:37 pm »
Hello Team,

Thanks for your feedback.

But according to our requirement, we need data for some more fields without adding fields in the row or column groups.

Please suggest any other option to add or achieve this.

paramvir

  • Administrator
  • Hero Member
  • *****
  • Posts: 6309
    • View Profile
Re: Show columns in pivot mode
« Reply #5 on: November 28, 2018, 11:05:21 pm »
Please recheck https://next.plnkr.co/edit/ZPx1bbU5tlnPWfY5

I've added some random values in Department column.