How can I hide a row column in a pivotgrid
I want to be able to get to the recordsource row for the current row. The best way to get the correct row is to use the Record ID property so I want to add that as a row column in the PivotGrid but I do not want the column to be displayed to the user.. Is there a way to set a row column to a property from the recordsource but not display the column to the user?
If this is not possible, is there another way to do this besides taking the values of all of the the row columns and doing a search in the recordsource for the corresponding row. This will not work for my situation in all cases, I do not have enough columns to always make the query unique, that is why I want to use the record ID property.
SIGN IN To post a reply.
3 Replies
SP
Subburaj Pandian Veluchamy
Syncfusion Team
August 5, 2019 12:24 PM UTC
Hi George,
We have analyzed the reported query “How to hide the row column in pivot grid”. You can hide the rows/columns of pivot grid control by using the RowHeights and ColWidths properties which is available in GridModel class. If you want to hide the row column values, you should set the ShowGroupBar value as false to avoid the overlapping between group bar and pivot grid control.
We have analyzed the reported query “How to hide the row column in pivot grid”. You can hide the rows/columns of pivot grid control by using the RowHeights and ColWidths properties which is available in GridModel class. If you want to hide the row column values, you should set the ShowGroupBar value as false to avoid the overlapping between group bar and pivot grid control.
Please refer the following code sample,
|
# Form1.vb
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.PivotGridControl1.ShowGroupBar = False
Me.PivotGridControl1.EnableValueEditing = True
AddHandler PivotGridControl1.TableControl.GroupDropArea.ColWidthsChanged,AddressOf GroupDropArea_ColWidthsChanged
'to hide the second column. PivotGridControl1.TableModel.ColWidths(2) = 0
End Sub
'To maintain the column width value as 0 after performing any drag and drop operation. Private Sub GroupDropArea_ColWidthsChanged(ByVal sender As Object, ByVal e AsSyncfusion.Windows.Forms.Grid.GridRowColSizeChangedEventArgs)
PivotGridControl1.TableModel.ColWidths(2) = 0
End Sub |
If it doesn’t meet your actual requirement, could you please share the detailed description about your requirement along with screenshots, so that it could be helpful to provide the solution at the earliest.
Regards,
Subburaj Pandian V
Subburaj Pandian V
GB
George Busby
August 17, 2019 12:32 PM UTC
Thanks, That hid the column. However, it did not hide the header for the column. Is there also a command to hide the column header that is associated with the column?
TB
Thirupathi Bala Krishnan
Syncfusion Team
August 19, 2019 01:48 PM UTC
Hi George,
Thanks for the update.
We have analyzed the reported query –“How to hide the group bar column headers when corresponding column width value is 0”. You can achieve this requirement by changing the value of RowGroupDropArea property. Also set the group bar item column width value based on the pivot grid column width.
Please refer the following code sample.
Thanks for the update.
We have analyzed the reported query –“How to hide the group bar column headers when corresponding column width value is 0”. You can achieve this requirement by changing the value of RowGroupDropArea property. Also set the group bar item column width value based on the pivot grid column width.
Please refer the following code sample.
|
# Form1.vb
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load 'to hide the second column.
PivotGridControl1.TableModel.ColWidths(2) = 0
AddHandler PivotGridControl1.TableControl.GroupDropArea.ColWidthsChanged, AddressOf GroupDropArea_ColWidthsChanged
AddHandler Me.PivotGridControl1.TableModel.ColWidthsChanged, AddressOf TableModel_ColWidthsChanged
'Resize the elements in row grouping bar.
Dim emptySpaceWidth As Integer = 6
Dim index As Integer
For j As Integer = 1 To 2 * (PivotGridControl1.TableControl.PivotRows.Count)
If j Mod 2 = 0 AndAlso PivotGridControl1.TableControl.RowGroupDropArea IsNot Nothing AndAlso PivotGridControl1.TableControl.RowGroupDropArea.Model IsNot Nothing Then
index = j / 2
PivotGridControl1.TableControl.RowGroupDropArea.Model.ColWidths(j) = If(PivotGridControl1.TableModel.ColWidths(index) = 0, 0, PivotGridControl1.TableModel.ColWidths(index) - (emptySpaceWidth + emptySpaceWidth / 2))
End If
Next
'Resize the entire row group bar width.
Dim width As Integer = 0
For i As Integer = 0 To PivotGridControl1.PivotRows.Count - 1
width += PivotGridControl1.TableModel.ColWidths(i)
Next
PivotGridControl1.TableControl.RowGroupDropArea.Width = width
End Sub
|
Sample link : https://www.syncfusion.com/downloads/support/forum/146441/ze/WindowsApp11175839624
If the above solution does not resolve your actual requirement, could you please share the detailed description so that it could be helpful to provide the solution at the earliest.
Regards,
Thirupathi B.
SIGN IN To post a reply.
- 3 Replies
- 3 Participants
-
GB George Busby
- Aug 3, 2019 08:19 PM UTC
- Aug 19, 2019 01:48 PM UTC