2012-12-08 25 views
1

我创建了一个示例来演示。我有一个名为“testView”的视图,有三列引用“field1”,“field2”,“field3”。XPage xe:listView不会隐藏列

当我在显示器上运行这个XPage所有三列时,它不应该显示第三列。单击该按钮也不会隐藏第二列。

谁能告诉我我有什么问题吗?

<?xml version="1.0" encoding="UTF-8"?> 
<xp:view xmlns:xp="http://www.ibm.com/xsp/core" 
    xmlns:xe="http://www.ibm.com/xsp/coreex" 
    xmlns:xc="http://www.ibm.com/xsp/custom"> 

    <xp:this.beforePageLoad><![CDATA[#{javascript:if (sessionScope.showCol2 == null) 
    sessionScope.showCol2 = true;}]]></xp:this.beforePageLoad> 
    <xe:restService id="restService1"> 
     <xe:this.service> 
      <xe:viewJsonService viewName="testView" 
       defaultColumns="true"> 
      </xe:viewJsonService> 
     </xe:this.service> 
    </xe:restService> 
    <xp:panel style="margin-left:20.0px;margin-top:20.0px"> 
     <xe:listView id="listView1" storeComponentId="restService1"> 
      <xe:listViewColumn id="listViewColumn1" columnName="field1" 
       columnTitle="Field1"> 
      </xe:listViewColumn> 
      <xe:listViewColumn id="listViewColumn2" columnName="field2" 
       columnTitle="Field2"> 
      <xe:this.rendered><![CDATA[#{javascript:return sessionScope.showCol2; 
}]]></xe:this.rendered></xe:listViewColumn> 
      <xe:listViewColumn id="listViewColumn3" columnName="field3" 
       columnTitle="Field3" rendered="false"> 
      </xe:listViewColumn> 
     </xe:listView></xp:panel> 
    <xp:panel style="margin-top:20.0px;margin-left:20.0px"> 
     <xp:button id="button1" value="Toggle Column 2"> 
      <xp:eventHandler event="onclick" submit="true" 
       refreshMode="partial" refreshId="listView1"> 
       <xp:this.action><![CDATA[#{javascript:if ( sessionScope.showCol2 == false) { 
    sessionScope.showCol2 = true; 
} 
else { 
    sessionScope.showCol2 = false; 
}}]]></xp:this.action> 
      </xp:eventHandler></xp:button> 
    </xp:panel></xp:view> 

回答

2

看起来像ExtLib中的错误。但是你可以在你的代码隐藏*财产隐藏的列:

<xp:button id="button1" value="Toggle Column 2"> 
    <xp:eventHandler event="onclick" submit="true" 
     refreshMode="partial" refreshId="listView1"> 
     <xp:this.action> 
      <![CDATA[#{javascript: 
       var cmp = getComponent('listViewColumn2'); 
       if(cmp.isHidden()){ 
        cmp.setHidden(false); 
       }else{ 
        cmp.setHidden(true); 
       } 
      }]]> 
     </xp:this.action> 
    </xp:eventHandler> 
</xp:button> 

*:该属性是隐藏得

+0

谢谢!这样可行。这在过去的几天里一直令我疯狂。 :) – Herty