Modular table - InfoPath Dev
in

InfoPath Dev

Modular table

Last post 12-04-2007 01:36 PM by Greg Collins. 3 replies.
Page 1 of 1 (4 items)
Sort Posts: Previous Next
  • 12-05-2006 02:06 PM

    • djay
    • Top 500 Contributor
    • Joined on 06-06-2006
    • Posts 35

    Modular table

    I want a repeating table who's column widths is dynamic and can be set by a value in the data source (or pragmatically). The only way I can think to do this is by a custom ActiveX control. But I don't really want to reinvent the repeating table...
    So, does anyone have any other ideas on how I could implement this?

    Thanks.
  • 12-05-2006 04:52 PM In reply to

    You can always use a preserve code block (do a search for info about that) and write the table code yourself. Then you can do things like you are talking about.

    The downside is that once you are in a preserve code block, you cannot modify the table in the designer--you have to do it by hand in the .xsl file.
  • 11-18-2007 04:14 PM In reply to

    • djay
    • Top 500 Contributor
    • Joined on 06-06-2006
    • Posts 35

    I finally got around to doing this.  Ended up being really easy once I dug into it.

    This is how I did it:

    I have a repeating table in the dataset called "Column" which has a field "ColumnWidth" which is the width of the column and "ColumnHead" is the title of the column.

    In managed code I have this function:

    public string PopulateColumn(string Input)

    {

    return "<col style=\"WIDTH: " + Input + "px\"></col>";

    }

     Then in the views .xsl I found the table and rewrote colgroup to look like this:

    <colgroup>

    <xsl:for-each select="my:Columns/my:Column">

    <xsl:value-of select="xdExtension:Populatecolumn(string(my:ColumnWidth))" disable-output-escaping="yes"></xsl:value-of>

    </xsl:for-each>

    </colgroup> 

    And in the <tbody> tag I have things like this:

    <xsl:for-each select="my:Columns/my:Column">

    <td>

    <div>

    <strong>

    <span class="xdTextBox" hideFocus="1" title="" tabIndex="0" xd:CtrlId="CTRL169" xd:xctname="PlainText" xd:binding="my:ColumnHead" style="WIDTH: 100%">

    <xsl:value-of select="my:ColumnHead"></xsl:value-of>

    </span>

    </strong>

    </div>

    </td>

    </xsl:for-each> 

    And of course the template this is in is set with a mode="xd:preserve"

    Easy.

  • 12-04-2007 01:36 PM In reply to

    Glad to hear you got it working. Thanks for sharing your solution with us.

Page 1 of 1 (4 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.