3 Replies Latest reply: Feb 22, 2014 3:04 AM by fac586 RSS

Custom row template - conditional data

VANJ Journeyer
Currently Being Moderated

APEX 4.2

 

in a custom report template (named column), where each row is rendered as a HTML table with #COLUMN# substitutions, the template has the column heading/labels hard wired. So how can we make it such that, based on the data, some table cells or entire rows are not rendered at all. Displaying the labels but no data looks silly.

 

Help? Thanks

  • 1. Re: Custom row template - conditional data
    fac586 Guru
    Currently Being Moderated

    Hi Vikas


    The preferred approach would be to use conditional row templates. This is declarative and nicely separates the data and HTML layers. I'm guessing that you've done this and need more than the 4 templates available (or know that you would if you did)? Feature request AIIE asks for APEX to support an unlimited number of conditional column/row templates.


    If there are insufficient row templates, then usually we have to violate the separation of concerns and generate some of the document structure in the report query.


    It would be easier to suggest some potential solutions if you could provide a concrete example showing the problem.

  • 2. Re: Custom row template - conditional data
    VANJ Journeyer
    Currently Being Moderated

    Hi Paul - Well, I would like to incorporate this into the "Detail View" of an Interactive Report and that doesn't support conditional row templates. Just the standard Before Rows/Row/After rows blocks. So, as much as I prefer to keep content & presentation separate, I am afraid I am going to have to embed markup in the query.

     

    Concrete example - It is kinda difficult to recreate it on apex.oracle.com but think of a transaction report where the "transaction type" determines which set of columns (either on the same TR or sporadic TDs here and there) are to be displayed (along with their corresponding labels). 

     

    Any other ideas? Could CSS visibility be used to conditionally hide rows/cells instead of modifying the markup?

  • 3. Re: Custom row template - conditional data
    fac586 Guru
    Currently Being Moderated

    VANJ wrote:


    Could CSS visibility be used to conditionally hide rows/cells instead of modifying the markup?

    Good idea. You could create logic in the query to include the "transaction type" as a hidden IR column and use this in class attribute values on elements in the Detail View definition. The class can then be used as a selector in visibility: collapse CSS rules to remove the unwanted rows and cells. However, note that visibility: collapse is not supported in IE7, and doesn't work correctly in Webkit browsers. I'd also check on the accessibility implications.

     

    I tend to forget about visibility: collapse because it doesn't work in Safari...

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points