Hide cross tab columns at run time without occupying space

Stimulsoft Reports.WEB discussion
Post Reply
ryanr.eventpalette
Posts: 11
Joined: Tue Apr 21, 2015 11:12 am

Hide cross tab columns at run time without occupying space

Post by ryanr.eventpalette »

I am using Stimulsoft Reports.Web 2015.1.
Our client requires a report in which columns can be shown/hidden based on user input.
Upon reading your forums, I learned that this can be done using cross tabs.
Indeed, this was achieved by using Conditions to manage the visibility of cross tab column fields
and adding code in the BeforeRender event of the page to manage the visibility of cross tab column headers.
However, even if a cross tab column is hidden/disabled, it still occupies its original space.
Is there a way in which when cross tab column is hidden/disabled, the next columns shifts to the left?
Can a cross tabs column's width be adjusted at run time?
If so, a possible option would be to just change the width of the column to zero and look like it didn't take space at all.
Please advise. Thanks.
Attachments
HideCrossTabColumn.png
HideCrossTabColumn.png (29.34 KiB) Viewed 2483 times
ryanr.eventpalette
Posts: 11
Joined: Tue Apr 21, 2015 11:12 am

Re: Hide cross tab columns at run time without occupying spa

Post by ryanr.eventpalette »

Here's a sample report I created which you can use to test.
Attachments
HideColumnSample.zip
(284.84 KiB) Downloaded 424 times
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Hide cross tab columns at run time without occupying spa

Post by HighAley »

Hello.

In your case it's better to use sample project from our Demo how to create better report.
Please, look at the Dialogs - Selecting Column report. You could do the same without dialog.
To avoid blank space you should set the Shift Mode of text components.

Thank you.
ryanr.eventpalette
Posts: 11
Joined: Tue Apr 21, 2015 11:12 am

Re: Hide cross tab columns at run time without occupying spa

Post by ryanr.eventpalette »

Hello,

I've checked the demo. It works but I'm afraid it doesn't fit the client requirement.

Our client requires a report with 3 sets of columns:
- 1st set contains fixed columns. (e.g. PersonId, FirstName, LastName)
- 2nd set contains optional columns. User may select from X number of optional columns (e.g. City, State, Country, HomePhone, WorkPhone, Mobile).
- 3rd set contains dynamic columns. Number of columns depend on data returned by SQL query (e.g. Would you like to volunteer to Mars? [Yes/No], In your opinion, can jet fuel melt steal beams? [Yes/No]).

Since I had to deal with dynamic columns (3rd set), I thought merely using text components on data bands will not do the trick.
That's the reason why I used cross tabs.
Actually, I had no problems with the 1st set and the 3rd set.
And I was almost able to make the 2nd set work if not for the issue of hidden/disabled columns still occupying space.
Is there a way to achieve our client requirement using cross tabs?
Please advise. Thanks.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Hide cross tab columns at run time without occupying spa

Post by HighAley »

Hello.

Maybe it's better to create a report in code dynamically?
Please, look at our sample project.

Thank you.
Attachments
DynamicCreateReportWithGroups.zip
(17.21 KiB) Downloaded 361 times
DynamicCreateReport.zip
(15.46 KiB) Downloaded 371 times
Post Reply