Search code examples
xpages

Is it possible to generate viewColumn using repeat ? It doesnt work for me :-(


Is it possible to generate viewColumn dynamicly using repeat control,? I have a viewPanel and repeater that runs over all columns in this view and try to create viewColumn control for each as below. It doesnt throw any error for me but also no table apear on screen ... I would like to generate it dynamicly as I have many existing views with up to 20 columns so maintaining this manualy would be not so nice. I also need to use viewPanel because a first view column is categorized so I need the viewPanel mechanism for epanding/collapsing these categories.

<xp:viewPanel rows="30" id="viewPanelMain" var="row" value="#{viewDS}">
  <xp:repeat id="repeat1" rows="100" value="#{javascript:myView.getColumns()}" disableOutputTag="true" var="column">
   <xp:viewColumn>
      <xp:this.columnName><![CDATA[#{javascript:column.getItemName()}]]></xp:this.columnName>
      <xp:viewColumnHeader value="#{javascript:column.getTitle()}"></xp:viewColumnHeader>
   </xp:viewColumn>
  </xp:repeat>
</xp:viewPanel>

Mabe there is some better way how to achieve the same result ... Any idea?


Solution

  • Have a look at the Dynamic View Panel control from the Extension Library (included as part of the Domino 9 installation). The following should work using your example:

    <xe:dynamicViewPanel value="#{viewDS}" id="dynamicViewPanel1" var="viewEntry">
    </xe:dynamicViewPanel>
    

    You can then consider customizing the look and fel using a customizer bean, you can add a pager, you can add an onColumnClick event etc.