Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Auto-adjust column widths in table or grid(Trying to make a grid or table whose column widths will be auto-adjusted based on contents)
Auto-adjust column widths in table or grid [message #1476322] Mon, 17 November 2014 01:57 Go to next message
Robert Mark Bram is currently offline Robert Mark BramFriend
Messages: 32
Registered: July 2009
Member
Hi All,

I am trying to make a table or grid whose column widths will automatically adjust based on the contents. Here is a snippet of my report where I am trying both a grid and table to see what happens.

In both cases, I have just one row, two columns. I am finding that the columns are always 50% each, with the longest column wrapping its content instead of what I expect - the left column should be narrow and the right column be wider, because they don't need to wrap.

 <table id="258">
     <column id="268"/>
     <column id="269"/>
     <header>
         <row id="259">
             <list-property name="visibility">
                 <structure>
                     <property name="format">all</property>
                     <expression name="valueExpr" type="javascript">true</expression>
                 </structure>
             </list-property>
             <cell id="260"/>
             <cell id="261"/>
         </row>
     </header>
     <detail>
         <row id="262">
             <property name="style">Heading</property>
             <property name="textAlign">center</property>
             <cell id="263">
                 <data id="270">
                     <property name="resultSetColumn">Business Unit 1</property>
                 </data>
             </cell>
             <cell id="264">
                 <data id="271">
                     <property name="resultSetColumn">Service Name 1</property>
                 </data>
             </cell>
         </row>
     </detail>
     <footer>
         <row id="265">
             <list-property name="visibility">
                 <structure>
                     <property name="format">all</property>
                     <expression name="valueExpr" type="javascript">true</expression>
                 </structure>
             </list-property>
             <cell id="266"/>
             <cell id="267"/>
         </row>
     </footer>
 </table>
 <grid id="59">
     <property name="whiteSpace">pre</property>
     <column id="60"/>
     <column id="61"/>
     <row id="62">
         <cell id="63">
             <property name="style">Heading</property>
             <property name="fontSize">20px</property>
             <property name="paddingTop">2px</property>
             <property name="textAlign">center</property>
             <data id="65">
                 <property name="resultSetColumn">Business Unit 1</property>
             </data>
         </cell>
         <cell id="64">
             <property name="style">Heading</property>
             <property name="fontSize">20px</property>
             <property name="paddingTop">2px</property>
             <property name="textAlign">center</property>
             <data id="66">
                 <property name="resultSetColumn">Service Name 1</property>
             </data>
         </cell>
     </row>
 </grid>



Any suggestions would be appreciated!

Rob
Smile

Re: Auto-adjust column widths in table or grid [message #1476335 is a reply to message #1476322] Mon, 17 November 2014 02:11 Go to previous messageGo to next message
Robert Mark Bram is currently offline Robert Mark BramFriend
Messages: 32
Registered: July 2009
Member
Here is a simpler example. I get the same result irrespective of setting report layout preference to "Auto Layout" or "Fixed Layout".

https://i.imgur.com/oybx9jF.png

With this code:

<cell id="43">
    <grid id="276">
        <column id="277"/>
        <column id="278"/>
        <column id="279"/>
        <row id="280">
            <cell id="281">
                <property name="borderBottomStyle">solid</property>
                <property name="borderBottomWidth">medium</property>
                <property name="borderLeftStyle">solid</property>
                <property name="borderLeftWidth">medium</property>
                <property name="borderRightStyle">solid</property>
                <property name="borderRightWidth">medium</property>
                <property name="borderTopStyle">solid</property>
                <property name="borderTopWidth">medium</property>
                <property name="textAlign">center</property>
                <text id="292">
                    <property name="contentType">auto</property>
                    <text-property name="content"><![CDATA[Some text]]></text-property>
                </text>
            </cell>
            <cell id="282">
                <property name="borderBottomStyle">solid</property>
                <property name="borderBottomWidth">medium</property>
                <property name="borderLeftStyle">solid</property>
                <property name="borderLeftWidth">medium</property>
                <property name="borderRightStyle">solid</property>
                <property name="borderRightWidth">medium</property>
                <property name="borderTopStyle">solid</property>
                <property name="borderTopWidth">medium</property>
                <property name="textAlign">center</property>
                <text id="295">
                    <property name="contentType">auto</property>
                    <text-property name="content"><![CDATA[A bit more text than before.]]></text-property>
                </text>
            </cell>
            <cell id="283">
                <property name="borderBottomStyle">solid</property>
                <property name="borderBottomWidth">medium</property>
                <property name="borderLeftStyle">solid</property>
                <property name="borderLeftWidth">medium</property>
                <property name="borderRightStyle">solid</property>
                <property name="borderRightWidth">medium</property>
                <property name="borderTopStyle">solid</property>
                <property name="borderTopWidth">medium</property>
                <property name="textAlign">center</property>
                <text id="300">
                    <property name="contentType">auto</property>
                    <text-property name="content"><![CDATA[Small]]></text-property>
                </text>
            </cell>
        </row>
        <row id="284">
            <cell id="285">
                <property name="borderBottomStyle">solid</property>
                <property name="borderBottomWidth">medium</property>
                <property name="borderLeftStyle">solid</property>
                <property name="borderLeftWidth">medium</property>
                <property name="borderRightStyle">solid</property>
                <property name="borderRightWidth">medium</property>
                <property name="borderTopStyle">solid</property>
                <property name="borderTopWidth">medium</property>
                <property name="textAlign">center</property>
                <text id="293">
                    <property name="contentType">auto</property>
                    <text-property name="content"><![CDATA[A little text]]></text-property>
                </text>
            </cell>
            <cell id="286">
                <property name="borderBottomStyle">solid</property>
                <property name="borderBottomWidth">medium</property>
                <property name="borderLeftStyle">solid</property>
                <property name="borderLeftWidth">medium</property>
                <property name="borderRightStyle">solid</property>
                <property name="borderRightWidth">medium</property>
                <property name="borderTopStyle">solid</property>
                <property name="borderTopWidth">medium</property>
                <property name="textAlign">center</property>
                <text id="298">
                    <property name="contentType">auto</property>
                    <text-property name="content"><![CDATA[Starting to have more text.]]></text-property>
                </text>
            </cell>
            <cell id="287">
                <property name="borderBottomStyle">solid</property>
                <property name="borderBottomWidth">medium</property>
                <property name="borderLeftStyle">solid</property>
                <property name="borderLeftWidth">medium</property>
                <property name="borderRightStyle">solid</property>
                <property name="borderRightWidth">medium</property>
                <property name="borderTopStyle">solid</property>
                <property name="borderTopWidth">medium</property>
                <property name="textAlign">center</property>
                <text id="301">
                    <property name="contentType">auto</property>
                    <text-property name="content"><![CDATA[Tiny]]></text-property>
                </text>
            </cell>
        </row>
        <row id="288">
            <cell id="289">
                <property name="borderBottomStyle">solid</property>
                <property name="borderBottomWidth">medium</property>
                <property name="borderLeftStyle">solid</property>
                <property name="borderLeftWidth">medium</property>
                <property name="borderRightStyle">solid</property>
                <property name="borderRightWidth">medium</property>
                <property name="borderTopStyle">solid</property>
                <property name="borderTopWidth">medium</property>
                <property name="textAlign">center</property>
                <text id="294">
                    <property name="contentType">auto</property>
                    <text-property name="content"><![CDATA[Not much text]]></text-property>
                </text>
            </cell>
            <cell id="290">
                <property name="borderBottomStyle">solid</property>
                <property name="borderBottomWidth">medium</property>
                <property name="borderLeftStyle">solid</property>
                <property name="borderLeftWidth">medium</property>
                <property name="borderRightStyle">solid</property>
                <property name="borderRightWidth">medium</property>
                <property name="borderTopStyle">solid</property>
                <property name="borderTopWidth">medium</property>
                <property name="textAlign">center</property>
                <text id="299">
                    <property name="contentType">auto</property>
                    <text-property name="content"><![CDATA[Bit more text than the previous column.]]></text-property>
                </text>
            </cell>
            <cell id="291">
                <property name="borderBottomStyle">solid</property>
                <property name="borderBottomWidth">medium</property>
                <property name="borderLeftStyle">solid</property>
                <property name="borderLeftWidth">medium</property>
                <property name="borderRightStyle">solid</property>
                <property name="borderRightWidth">medium</property>
                <property name="borderTopStyle">solid</property>
                <property name="borderTopWidth">medium</property>
                <property name="textAlign">center</property>
                <text id="302">
                    <property name="contentType">auto</property>
                    <text-property name="content"><![CDATA[Nothing]]></text-property>
                </text>
            </cell>
        </row>
    </grid>
Re: Auto-adjust column widths in table or grid [message #1476340 is a reply to message #1476335] Mon, 17 November 2014 02:15 Go to previous messageGo to next message
Robert Mark Bram is currently offline Robert Mark BramFriend
Messages: 32
Registered: July 2009
Member
Environment:
Eclipse Java EE IDE for Web Developers.
Version: Luna Release (4.4.0)
Build id: 20140612-0600
Birt 4.4.4.0
Re: Auto-adjust column widths in table or grid [message #1494978 is a reply to message #1476340] Mon, 01 December 2014 22:46 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

So, the auto layout doesn't help at all? Would you be opposed to scripting to get the look you're wanting?

Michael

Developer Evangelist, Silanis
Previous Topic:Secondary data set null access issue
Next Topic:Problems with running birt reports using jboss tools in Birt viewer (4.4.0)
Goto Forum:
  


Current Time: Sat Apr 20 15:02:25 GMT 2024

Powered by FUDForum. Page generated in 0.03460 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top