Dynamic Table Control - InfoPath Dev
in

InfoPath Dev

Dynamic Table Control

Last post 09-08-2009 11:45 PM by Shweta. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 08-24-2009 12:26 AM

    • Shweta
    • Not Ranked
    • Joined on 08-24-2009
    • Posts 2

    Dynamic Table Control

    Hi, I have an urgent requirement to add Dynamic table control in Infopath.

    User should be able to

    1) Add/Delete columns at runtime

    2) Set width of columns at runtime.

    3) Add rich text data in table cell.

    Bascially I need to provide all features which a word table provides. I have to provide a word like table control to add data.

    I tried to build a table using horizontal repeating table inside a repeating table but it it doesn't work. Width cannot be set at runtime. Also I cannot control the behaviour of all rows of a horizontal table in a row so that If height of one row of horizontal table is changed then height for all rows should be set accordingly.

    So now I am looking for some other ideas. Is there any table custom control which can be added? Has someone tried using Flexgrid control? How does it works?

    Please help. 

    Thanks,

    Shweta

  • 08-27-2009 02:02 AM In reply to

    change the type off fields in the table to to rich text (XHTML).

    Qazi Anis
    Technical Architect
    Bitwise Inc
  • 09-08-2009 11:45 PM In reply to

    • Shweta
    • Not Ranked
    • Joined on 08-24-2009
    • Posts 2

    Thanks for the reply.

    I have created my own table inside preserve block.

    Below is my data structure:

    TCBlock_Table
     TCBlock_Table_AttrGroup 
      TCBlock_Table_Attr
       TCBlock_Table_Attr_Name
       TCBlock_Table_Attr_Width
     TCBlock_Table_CatGroup 
      TCBlock_Table_Cat
       TCBlock_Table_Cat_Name
       TCBlock_Table_Cat_Width
     TCBlock_Table_Row_Group 
      TCBlock_Table_Row
       TCBlock_Table_Col_Group 
        TCBlock_Table_Col
         TCBlock_Table_Data
         TCBlock_Table_Col_Width

    Schema:

    <xsd:element name="TCBlock_Table">

    <xsd:complexType>

    <xsd:sequence>

    <xsd:element ref="my:TCBlock_Table_AttrGroup" minOccurs="0"/>

    <xsd:element ref="my:TCBlock_Table_CatGroup" minOccurs="0"/>

    <xsd:element ref="my:TCBlock_Table_Row_Group" minOccurs="0"/>

    </xsd:sequence>

    </xsd:complexType>

    </xsd:element>

    <xsd:element name="TCBlock_Table_AttrGroup">

    <xsd:complexType>

    <xsd:sequence>

    <xsd:element ref="my:TCBlock_Table_Attr" minOccurs="0" maxOccurs="unbounded"/>

    </xsd:sequence>

    </xsd:complexType>

    </xsd:element>

    <xsd:element name="TCBlock_Table_Attr">

    <xsd:complexType>

    <xsd:sequence>

    <xsd:element ref="my:TCBlock_Table_Attr_Name" minOccurs="0"/>

    <xsd:element ref="my:TCBlock_Table_Attr_Width" minOccurs="0"/>

    </xsd:sequence>

    </xsd:complexType>

    </xsd:element>

    <xsd:element name="TCBlock_Table_Attr_Name" type="xsd:string"/>

    <xsd:element name="TCBlock_Table_Attr_Width" type="xsd:string"/>

    <xsd:element name="TCBlock_Table_CatGroup">

    <xsd:complexType>

    <xsd:sequence>

    <xsd:element ref="my:TCBlock_Table_Cat" minOccurs="0" maxOccurs="unbounded"/>

    </xsd:sequence>

    </xsd:complexType>

    </xsd:element>

    <xsd:element name="TCBlock_Table_Cat">

    <xsd:complexType>

    <xsd:sequence>

    <xsd:element ref="my:TCBlock_Table_Cat_Name" minOccurs="0"/>

    <xsd:element ref="my:TCBlock_Table_Cat_Width" minOccurs="0"/>

    </xsd:sequence>

    </xsd:complexType>

    </xsd:element>

    <xsd:element name="TCBlock_Table_Cat_Name" type="xsd:string"/>

    <xsd:element name="TCBlock_Table_Cat_Width" type="xsd:string"/>

    <xsd:element name="TCBlock_Table_Row_Group">

    <xsd:complexType>

    <xsd:sequence>

    <xsd:element ref="my:TCBlock_Table_Row" minOccurs="0" maxOccurs="unbounded"/>

    </xsd:sequence>

    </xsd:complexType>

    </xsd:element>

    <xsd:element name="TCBlock_Table_Row">

    <xsd:complexType>

    <xsd:sequence>

    <xsd:element ref="my:TCBlock_Table_Col_Group" minOccurs="0"/>

    <xsd:element ref="my:TCBlock_Table_CondNoIndex" minOccurs="0"/>

    </xsd:sequence>

    </xsd:complexType>

    </xsd:element>

    <xsd:element name="TCBlock_Table_Col_Group">

    <xsd:complexType>

    <xsd:sequence>

    <xsd:element ref="my:TCBlock_Table_Col" minOccurs="0" maxOccurs="unbounded"/>

    </xsd:sequence>

    </xsd:complexType>

    </xsd:element>

    <xsd:element name="TCBlock_Table_Col">

    <xsd:complexType>

    <xsd:sequence>

    <xsd:element ref="my:TCBlock_Table_Data" minOccurs="0"/>

    <xsd:element ref="my:TCBlock_Table_Col_Width" minOccurs="0"/>

    </xsd:sequence>

    </xsd:complexType>

    </xsd:element>

    <xsd:element name="TCBlock_Table_Data">

    <xsd:complexType mixed="true">

    <xsd:sequence>

    <xsd:any minOccurs="0" maxOccurs="unbounded" namespace="http://www.w3.org/1999/xhtml" processContents="lax"/>

    </xsd:sequence>

    </xsd:complexType>

    </xsd:element>

    <xsd:element name="TCBlock_Table_Col_Width" type="xsd:string"/>

    <xsd:element name="TCBlock_Table_CondNoIndex" type="xsd:string"/>

    Here's the code for reference:

    <xsl:template match="my:TCBlock_Table" mode="xd:preserve">
      <table class="xdRepeatingTable msoUcTable" title="" style="TABLE-LAYOUT:

    fixed;  BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none;

    BORDER-COLLAPSE: collapse; WORD-WRAP: break-word; BORDER-BOTTOM-STYLE: none" border="1"

    borderColor="buttontext" xd:CtrlId="CTRL1"

    xmlns:ipApp="http://schemas.microsoft.com/office/infopath/2006/XPathExtension/ipApp">
       <colgroup>
        <xsl:for-each

    select="my:TCBlock_Table_AttrGroup/my:TCBlock_Table_Attr">
         <col></col>
        </xsl:for-each>
       </colgroup>
       <tbody>
        <tr style="BACKGROUND-COLOR: #e1e1e1;">
         <xsl:for-each

    select="my:TCBlock_Table_CatGroup/my:TCBlock_Table_Cat">
          <!--<td

    style="WIDTH:my:TCBlock_Table_Col_Width; PADDING-RIGHT: 0px; PADDING-LEFT: 0px;

    PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; ">-->
          <xsl:value-of

    select="xdExtension:getOpenTDTag(string(my:TCBlock_Table_Cat_Width))"

    disable-output-escaping="yes"></xsl:value-of>
          <span class="xdTextBox" hideFocus="1"

    border="0" title="" tabIndex="-1" xd:disableEditing="yes" xd:CtrlId="CTRL13"

    xd:xctname="PlainText" xd:binding="my:TCBlock_Table_Attr_Name" style=" TEXT-ALIGN: center;

    BACKGROUND-COLOR: #e1e1e1;OVERFLOW-Y: visible;WIDTH: 100%; WHITE-SPACE: normal; WORD-WRAP:

    break-word ;BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none;

    BORDER-BOTTOM-STYLE: none;">
           <xsl:value-of

    select="my:TCBlock_Table_Cat_Name"></xsl:value-of>
          </span>
          <!--<xsl:apply-templates

    select="my:TCBlock_Table_Cat_Name" mode="xd:preserve"></xsl:apply-templates>-->
          <xsl:value-of

    select="xdExtension:getCloseTDTag()" disable-output-escaping="yes"></xsl:value-of>
         </xsl:for-each>
        </tr>
       </tbody>
       <tbody>
        <!--class="xdTableHeader"-->
        <tr>
         <xsl:for-each

    select="my:TCBlock_Table_AttrGroup/my:TCBlock_Table_Attr">
          <!--<td

    style="WIDTH:{xdXDocument:GetNamedNodeProperty(., 'TCColWidth', '10px')}; PADDING-RIGHT:

    0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; ">-->
          <xsl:value-of

    select="xdExtension:getOpenTDTag(string(my:TCBlock_Table_Attr_Width))"

    disable-output-escaping="yes"></xsl:value-of>
          <span class="xdTextBox" hideFocus="1"

    border="0" title="" tabIndex="-1" xd:disableEditing="yes" xd:CtrlId="CTRL13"

    xd:xctname="PlainText" xd:binding="my:TCBlock_Table_Attr_Name" style=" TEXT-ALIGN: center;

    OVERFLOW-Y: visible;WIDTH: 100%; WHITE-SPACE: normal; WORD-WRAP: break-wordl;

    ;BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none;

    BORDER-BOTTOM-STYLE: none;">
           <xsl:value-of

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

    select="xdExtension:getCloseTDTag()" disable-output-escaping="yes"></xsl:value-of>
         </xsl:for-each>
        </tr>
       </tbody>
       <tbody xd:xctname="RepeatingTable">
        <xsl:for-each

    select="my:TCBlock_Table_Row_Group/my:TCBlock_Table_Row">
         <tr>
          <xsl:for-each

    select="my:TCBlock_Table_Col_Group/my:TCBlock_Table_Col">
           <!--<td

    style="WIDTH:{xdXDocument:GetNamedNodeProperty(., 'TCColWidth', '10px')}; PADDING-RIGHT:

    0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; MARGIN: 0px; PADDING-TOP: 0px; ">-->
           <xsl:value-of

    select="xdExtension:getOpenTDTag(string(my:TCBlock_Table_Col_Width))"

    disable-output-escaping="yes"></xsl:value-of>
           <span class="xdRichTextBox"

    hideFocus="1" title="" tabIndex="0" xd:CtrlId="CTRL11" xd:xctname="RichText"

    xd:binding="my:TCBlock_Table_Data" border="0" style="WIDTH: 100%; HEIGHT: 20px;

    BORDER-TOP-STYLE: none; BORDER-RIGHT-STYLE: none; BORDER-LEFT-STYLE: none; WORD-WRAP:

    break-word; BORDER-BOTTOM-STYLE: none">
            <xsl:copy-of

    select="my:TCBlock_Table_Data/node()"></xsl:copy-of>
            <div></div>
           </span>
           <!--<xsl:apply-templates

    select="my:TCBlock_Table_Data" mode="xd:preserve"></xsl:apply-templates>-->
           <xsl:value-of

    select="xdExtension:getCloseTDTag()" disable-output-escaping="yes"></xsl:value-of>
          </xsl:for-each>
         </tr>
        </xsl:for-each>
       </tbody>
      </table>
     </xsl:template>

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