Dynamic Details Section Height

8 posts, 0 answers
  1. Paul
    Paul avatar
    16 posts
    Member since:
    Jan 2012

    Posted 11 Jan 2012 Link to this post

    Hello,

    In the report I am trying to make, each row in the dataset can have different types of data associated with it. 

    i.e.  Record1 uses Data1,Data2,Data3.
    Record2 uses Data3, Data4.

    When displayed, Record1 would only show the Data1, Data2, and Data3 sections while hiding the Data4 section.  Likewise, Record2 would hide the Data1 and Data2 sections while displaying the Data3 and Data4 sections.

    In other reporting systems, I was able to add multiple detail sections and hide them if the record did not use that type of data.  As I cannot have multiple detail sections in a single report, I was hoping to pack the data into panels and hide the panel if the data was not applicable to that record.  However, the details section's height does not automatically scale.  So for some records with virtually no data associated with them, a large blank area is still shown for that record.  I want to eliminate that.

    Is there a way to trim the excess whitespace or is this type of report not supported?
  2. IvanY
    Admin
    IvanY avatar
    417 posts

    Posted 12 Jan 2012 Link to this post

    Hi Paul,

    You can use Conditional Formatting Rules to hide the sections that have irrelevant data (you just have to set the Visible property to false) - when the item is invisible it does not take up space. For more information you can check our Conditional Formatting KB article.

    All the best,
    IvanY
    the Telerik team

    Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

  3. Paul
    Paul avatar
    16 posts
    Member since:
    Jan 2012

    Posted 12 Jan 2012 Link to this post

    Thanks for the reply, but that isn't the problem I'm having.

    I've attached an image which describes the problem.

    For each record, there are several data items that we may or may not want to display.  They are the optional data panels.  If they are not wanted, the visible property is set to false.  That element then takes up no space.  That works very well.  But the problem is that the Detail section is a fixed size, taking up just as much space for each record, whether or not the record needs the space.

    Is there some way I can get the Details section's height to vary between records?  Or is there another way I can get this effect?
  4. Paul
    Paul avatar
    16 posts
    Member since:
    Jan 2012

    Posted 16 Jan 2012 Link to this post

    The question I have comes down to:

    Can the details section's height vary per record item through either the designer or code-behind?

    If not, is there another approach that would have a similar effect?
  5. Elian
    Admin
    Elian avatar
    435 posts

    Posted 16 Jan 2012 Link to this post

    Hi,

    You can programmatically shrink the sections in the constructor after the InitializeComponent() call.

    public Report1()
    {
        //
        // Required for telerik Reporting designer support
        //
        InitializeComponent();
     
        this.detail.Height = Unit.Cm(0.01);
    This will make the section as high as the items inside. Kind regards,
    Elian
    the Telerik team

    Q3’11 of Telerik Reporting is available for download. Register for the What's New in Data Tools webinar to see what's new and get a chance to WIN A FREE LICENSE!

  6. Paul
    Paul avatar
    16 posts
    Member since:
    Jan 2012

    Posted 27 Jan 2012 Link to this post

    I've figured out how to get my idea working. 

    All that needs to be done is to add groups.  I've added many groups all grouping on the primary key.  Now I can set up the different displaying conditions I wanted, each in its own group, and use conditional formatting to only set the visible = true property to the single group I want to display. 

    That's the behavior I was looking for.  So now I can have each group whatever size I want it and there is no whitespace added to the report if I hide the group.
  7. Shane
    Shane avatar
    10 posts
    Member since:
    Nov 2014

    Posted 06 Apr 2015 in reply to Elian Link to this post

    How would you do this with the MVC implementation? The report is created on the html page, and I do not use an InitializeComenent() for each report.
  8. Nasko
    Admin
    Nasko avatar
    1067 posts

    Posted 09 Apr 2015 Link to this post

    Hello Shane,

    With the MVC Report Viewer you need to use a custom report resolver, where you can create and modify the report object. For more information, please refer to the How To: Implement a Custom Report Resolver help article.

    Regards,
    Nasko
    Telerik
     

    See What's Next in App Development. Register for TelerikNEXT.

     
Back to Top