2010-07-27 56 views
0

在我的应用程序中,我需要一个用户能够在表格中选择一行。当他们完成对来自该行的数据的处理时,他们点击取消/重置按钮来重置其他页面元素。我需要做的是还使重置按钮不亮或取消选择数据表中突出显示/选定的行。我一直无法弄清楚在我的支持bean中做什么来实现这个工作。Unhighlight a rich in a rich:ScrollableDataTable

从我的JSP页面:

<rich:scrollableDataTable id="adjusterScheduleScrollableDataTableId" height="200px" 
      width="807px" rows="10" sortMode="single" var="item" 
      value="#{controller.searchResults}" selectionMode="single" 
      binding="#{controller.table}" selection="#{controller.selection}"> 
     <a:support event="onRowClick" action="#{controller.enableTools}" reRender="tools"/> 
     ... 
     multiple columns 
     ... 
</r:scrollableDataTable> 
<h:panelGroup id="tools"> 
    <h:commandButton id="reset" action="#{controller.reset}" value="Reset" /> 
</h:panelGroup> 

从我的支持bean:

private UIScrollableDataTable table;private Selection selection; 
... 
    public String reset(){ 
     //WHAT GOES HERE TO UNSELECT ROW?? 
    } 
... 
+0

请提出您的问题.. – TaherT 2010-07-28 08:18:26

+0

我不知道您的意思?当显示表格并在该行上单击行时突出显示。我想单击重置并从backingbean unighighlight那一行。那里有什么不清楚的地方吗? – SomeFatMan 2010-07-28 13:32:37

回答

3

所以我设法找出解决我的问题。我实在惊讶没有人能够回答这个问题。

private UIScrollableDataTable table;private Selection selection; 
... 
    public String reset(){ 
     table.setSelection(new SimpleSelection()); 
    } 
... 
+0

您也可以使用'this.selection.addKey(0);'选择第一行。 @SomeFatMan – MAbraham1 2012-02-16 22:08:56

0

需要清除两件事情,即活动行和所选行。

private UIScrollableDataTable table; 
table.setActiveRowKey(-1); 
((SimpleSelection)table.getSelection()).clear();