Skip to main content
Solved

Hide empty columns in DevExpress

  • November 25, 2024
  • 3 replies
  • 88 views

Mark Leunissen
Captain
Forum|alt.badge.img+4

Hi all,

 

When creating a report, I want empty columns to be hidden in a report. However, I am struggling to find the right way to get this working. 

At this moment, I have created a reporting page that allows users to select parameters that are needed in a report. When a parameter is selected, the view query gathers the values of the parameter. However, when a parameter is not selected, the view sets the value of the parameter to null. In terms of code, this works fine. The problem occurs when the report is created.

DevExpress makes it quite difficult to hide columns based upon the value of the column, but I have succeeded in this. However, I want the next column to take the place of the hidden column in order to have a clean looking report. This is where I am struggling to find the right solution.

Thanks in advance.

Best answer by Arjan Sollie

Hi Mark,

As far as I know it is not possible to hide columns and then have other columns move up over this column.

What I usually do is, work with hiding sections based on conditions instead of columns. This allows you to place different columns on the same position of your document and based on the condition you only display the section with the correct format for the specific scenario.

Another way to place different columns on the same position is that you place all these columns on the same location in your document and you hide them based on conditions, resulting in always showing just 1 of these columns at the time. So based on the different condition there can only be 1 column that is visible. All of the others will be hidden. This solution is the less preferred solution compared to working with the different sections.

View original
This topic has been closed for replies.

Arjan Sollie
Thinkwise blogger
Forum|alt.badge.img+14
  • Thinkwise blogger
  • December 11, 2024

Hi Mark,

As far as I know it is not possible to hide columns and then have other columns move up over this column.

What I usually do is, work with hiding sections based on conditions instead of columns. This allows you to place different columns on the same position of your document and based on the condition you only display the section with the correct format for the specific scenario.

Another way to place different columns on the same position is that you place all these columns on the same location in your document and you hide them based on conditions, resulting in always showing just 1 of these columns at the time. So based on the different condition there can only be 1 column that is visible. All of the others will be hidden. This solution is the less preferred solution compared to working with the different sections.


Mark Leunissen
Captain
Forum|alt.badge.img+4

Hi Arjan,

What do you mean with sections? Do you perhaps have an example?

I my case I want columns to be removed/hidden based on the condition that the view generates the columns as empty when the parameter is not selected. I have managed to use this condition to set the width of the columns to 0 and the following column to take the place of the hidden column. However, the column still exists, only with a width of 0.


Jeroen van den Belt
Administrator
Forum|alt.badge.img+9

As I understand it, you can create multiple sections which divide your report into multiple areas, and determine for each section whether it should be shown or not.

However, this seems more like a DevExpress-specific question, so you might find more help in their Community/Documentation. Perhaps this is a good starting point: https://docs.devexpress.com/WindowsForms/89/controls-and-libraries/printing-exporting/concepts/basic-terms/document-sections.

Please let us know if you have any follow-up questions related to Thinkwise on this topic.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings