Forum Stats

  • 3,874,218 Users
  • 2,266,685 Discussions
  • 7,911,771 Comments

Discussions

Setting a Report Column Width?

Howard (... in Training)
Howard (... in Training) Member Posts: 905
edited Jan 24, 2013 7:50AM in APEX Discussions
I was half griping about setting column width so it's only fair that I actually try a simple example.

I've got a simple report on a query (Select * from demo_st) based on a report region template. The columns displayed are the primary key (RCD_ID), the ST (state abbreviation) and the ST_NM (state name). State names are sized 4 to n characters and I added an "example" entry AAA AAA AAA AAA AAA AAA AA just so I'd have a long one. I'd want to control the width of the ST_NM column.

Please see: http://apex.oracle.com/pls/apex/f?p=66049:2 Dever / Ima9Dever

First, do I have the example set up correctly? For example, am I doing something that prevents controlling the ST_NM column width?

Second, if the example is set up correctly, is there some limit (say, < 6) below which I can't control the width.

In the ST_NM Column Definition, I have placed 5 in Column Width and in Column Attributes, I have placed 5 in Element Width.

I expected the ST_NM column width to be 5 characters but it renders just as before.

Am I doing something that prevents this column from truncating (or wrapping)?

Thanks in advance,
Howard

Best Answer

  • fac586
    fac586 Senior Technical Architect Member Posts: 21,456 Red Diamond
    Answer ✓
    Howard (DBA in Training) wrote:
    I was half griping about setting column width so it's only fair that I actually try a simple example.

    I've got a simple report on a query (Select * from demo_st) based on a report region template. The columns displayed are the primary key (RCD_ID), the ST (state abbreviation) and the ST_NM (state name). State names are sized 4 to n characters and I added an "example" entry AAA AAA AAA AAA AAA AAA AA just so I'd have a long one. I'd want to control the width of the ST_NM column.

    Please see: http://apex.oracle.com/pls/apex/f?p=66049:2 Dever / Ima9Dever

    First, do I have the example set up correctly? For example, am I doing something that prevents controlling the ST_NM column width?

    Second, if the example is set up correctly, is there some limit (say, < 6) below which I can't control the width.

    In the ST_NM Column Definition, I have placed 5 in Column Width and in Column Attributes, I have placed 5 in Element Width.

    I expected the ST_NM column width to be 5 characters but it renders just as before.

    Am I doing something that prevents this column from truncating (or wrapping)?
    See post on original thread: +{message:id=10807690}+
«1

Answers

  • Sc0tt
    Sc0tt Member Posts: 1,708
    I could be wrong, but I think those are for elements (HTML inputs) - like the width of a text box and length of a text box.

    You'll need to use some CSS if it is text.

    Just a helpful hint too - if you can make your demo pages public it would be nice. It's a pain to have to log in to look at to help you.
  • Mahmoud_Rabie
    Mahmoud_Rabie Cloud Solution Architect, Member Posts: 3,216 Bronze Crown
    edited Jan 22, 2013 3:40PM
    Dear Howard,

    Please, give us the sample workspace information

    Regards
    Mahmoud
  • fac586
    fac586 Senior Technical Architect Member Posts: 21,456 Red Diamond
    Answer ✓
    Howard (DBA in Training) wrote:
    I was half griping about setting column width so it's only fair that I actually try a simple example.

    I've got a simple report on a query (Select * from demo_st) based on a report region template. The columns displayed are the primary key (RCD_ID), the ST (state abbreviation) and the ST_NM (state name). State names are sized 4 to n characters and I added an "example" entry AAA AAA AAA AAA AAA AAA AA just so I'd have a long one. I'd want to control the width of the ST_NM column.

    Please see: http://apex.oracle.com/pls/apex/f?p=66049:2 Dever / Ima9Dever

    First, do I have the example set up correctly? For example, am I doing something that prevents controlling the ST_NM column width?

    Second, if the example is set up correctly, is there some limit (say, < 6) below which I can't control the width.

    In the ST_NM Column Definition, I have placed 5 in Column Width and in Column Attributes, I have placed 5 in Element Width.

    I expected the ST_NM column width to be 5 characters but it renders just as before.

    Am I doing something that prevents this column from truncating (or wrapping)?
    See post on original thread: +{message:id=10807690}+
  • dominiquefortin
    dominiquefortin Member Posts: 23 Blue Ribbon
    When you edit a column, in the "Column Definition" region you'll find "Column Width" field. The dimension for this field is in pixels, so try something like 300.
  • Howard (... in Training)
    Howard (... in Training) Member Posts: 905
    edited Jan 22, 2013 8:42PM
    Since this is APEX, I'm looking for a nice simple declaritive solution. I'm thinking it ought to be possible with either Column Width or Element Width. And folks do point me to those as a solution. But try as I might, no luck. It shouldn't be that hard,should it? I tried 50, 100, 200 and 300 for Column Width. Then I tried 50 for Element Width. No luck. (The point of my example is to make the column significantly narrower than it is by default.)

    Thoughts on getting Column Width or Element Width to work?

    (If I'm successful at getting the column narrower, then I'll want to work on what the options are for wrapping -- but one thing at a time.)

    Thanks,
    Howard
  • fac586
    fac586 Senior Technical Architect Member Posts: 21,456 Red Diamond
    Howard (DBA in Training) wrote:
    Since this is APEX, I'm looking for a nice simple declaritive solution. I'm thinking it ought to be possible with either Column Width or Element Width. And folks do point me to those as a solution. But try as I might, no luck. It shouldn't be that hard,should it? I tried 50, 100, 200 and 300 for Column Width. Then I tried 50 for Element Width. No luck. (The point of my example is to make the column significantly narrower than it is by default.)

    Thoughts on getting Column Width or Element Width to work?
    The Standard report template Column Templates in theme 21 are missing the <tt>#COLUMN_WIDTH#</tt> substitution string, as discussed here: +{message:id=9372903}+.

    I'm not sure why this would be missing from a supposedly "modern" theme (possibly the lack of documentation even affects Oracle's own theme designers), but you can add it to the templates as shown in that thread.

    Personally I prefer the CSS approach using attribute selectors, as described in the thread referenced in my previous post.
  • Re: From {message:id=9372903}
    There was no #COLUMN_WIDTH# substitution string in your template. I've now added it and it appears to be working:
    <td #ALIGNMENT# headers="#COLUMN_HEADER_NAME#" class="data" #COLUMN_WIDTH#>#COLUMN_VALUE#</td>
    Great. Thanks. But ... where would I do this? If this a mere override, I can do that from the page definition? That would be great. If not, I'll have to make my own copy of the template. Then, where among the code would this addition go?
    <div class="rounded-corner-region" id="#REGION_STATIC_ID#" #REGION_ATTRIBUTES#>
      <div class="rc-gray-top"><div class="rc-gray-top-r">
        <div class="rc-title">#TITLE#</div>
        <div class="rc-buttons">#CLOSE##PREVIOUS##NEXT##DELETE##EDIT##CHANGE##CREATE##CREATE2##EXPAND##COPY##HELP#</div>
      </div></div>
      <div class="rc-body"><div class="rc-body-r"><div class="rc-content-main">#BODY#<div class="clear"></div></div></div></div>
      <div class="rc-bottom"><div class="rc-bottom-r"></div></div>
    </div> 
    Surely it goes with the "BODY" but I have no idea how the two go together. (Basically, I'm doing APEX-BY-EXAMPLE. If I've seen an example, then I know one way to do it. Without an example, it's trial and eror and error and error ....)


    [Aside: So it's not APEX's fault that the builder of theme 21 (and 17 which I use elsewhere) didn't choose to include this. I supose these themes pre-date the version of APEX which included #COLUMN_WIDTH# in the page attributes.]

    Thanks,
    Howard
  • VC
    VC Member Posts: 2,413 Gold Trophy
    edited Jan 23, 2013 8:38AM
    Howard (DBA in Training) wrote:
    Re: From {message:id=9372903}
    There was no #COLUMN_WIDTH# substitution string in your template. I've now added it and it appears to be working:
    <td #ALIGNMENT# headers="#COLUMN_HEADER_NAME#" class="data" #COLUMN_WIDTH#>#COLUMN_VALUE#</td>
    Great. Thanks. But ... where would I do this? If this a mere override, I can do that from the page definition? That would be great. If not, I'll have to make my own copy of the template. Then, where among the code would this addition go?
    <div class="rounded-corner-region" id="#REGION_STATIC_ID#" #REGION_ATTRIBUTES#>
    <div class="rc-gray-top"><div class="rc-gray-top-r">
    <div class="rc-title">#TITLE#</div>
    <div class="rc-buttons">#CLOSE##PREVIOUS##NEXT##DELETE##EDIT##CHANGE##CREATE##CREATE2##EXPAND##COPY##HELP#</div>
    </div></div>
    <div class="rc-body"><div class="rc-body-r"><div class="rc-content-main">#BODY#<div class="clear"></div></div></div></div>
    <div class="rc-bottom"><div class="rc-bottom-r"></div></div>
    </div> 
    Surely it goes with the "BODY" but I have no idea how the two go together. (Basically, I'm doing APEX-BY-EXAMPLE. If I've seen an example, then I know one way to do it. Without an example, it's trial and eror and error and error ....)
    Howard,

    You are looking in the region template, look into your report template instead.

    Cheers,
    Vikram
    VC
  • fac586
    fac586 Senior Technical Architect Member Posts: 21,456 Red Diamond
    Howard (DBA in Training) wrote:
    Re: From {message:id=9372903}
    There was no #COLUMN_WIDTH# substitution string in your template. I've now added it and it appears to be working:
    <td #ALIGNMENT# headers="#COLUMN_HEADER_NAME#" class="data" #COLUMN_WIDTH#>#COLUMN_VALUE#</td>
    Great. Thanks. But ... where would I do this? If this a mere override, I can do that from the page definition?
    No. CSS overrides can be applied using page attributes, template HTML customization can't.
    That would be great. If not, I'll have to make my own copy of the template. Then, where among the code would this addition go?
    <div class="rounded-corner-region" id="#REGION_STATIC_ID#" #REGION_ATTRIBUTES#>
    <div class="rc-gray-top"><div class="rc-gray-top-r">
    <div class="rc-title">#TITLE#</div>
    <div class="rc-buttons">#CLOSE##PREVIOUS##NEXT##DELETE##EDIT##CHANGE##CREATE##CREATE2##EXPAND##COPY##HELP#</div>
    </div></div>
    <div class="rc-body"><div class="rc-body-r"><div class="rc-content-main">#BODY#<div class="clear"></div></div></div></div>
    <div class="rc-bottom"><div class="rc-bottom-r"></div></div>
    </div> 
    That's a region template, not a report template. (People keep making that mistake when report templates are mentioned. Why did you end up with that rather than the report template?)

    Go to Shared Components > Templates. Set the Theme filter to "21. Scarlet", the Type filter to "Report", and click "Go". Select the "Standard" template. Look for the "Column Templates" section...
    [Aside: So it's not APEX's fault that the builder of theme 21 (and 17 which I use elsewhere) didn't choose to include this. I supose these themes pre-date the version of APEX which included #COLUMN_WIDTH# in the page attributes.]
    No they don't. That's why I find it odd.
  • Re:
    That's a region template, not a report template. (People keep making that mistake when report templates are mentioned. Why did you end up with that rather than the report template?)
    Go to Shared Components > Templates. Set the Theme filter to "21. Scarlet", the Type filter to "Report", and click "Go". Select the "Standard" template. Look for the "Column Templates" section...
    >
    "Why?" Well, if I edit the page, the tempate used is "Reports Region". When I created the page, I selected the "Report" icon for the Region Type.
    But, okay, I copied the Standard template to "Standard with Column Width" because I don't want to override Standard. I've modified it. So, now I need to know where Standard is used so I can copy that and change it to reference "Standard with Column Width". How would I do that?

    Thanks,
    Howard
This discussion has been closed.