views:

104

answers:

1

Hello,

In my application I need a user to be able to select a row in a table. When they are done working with the data from that row they click a cancel/reset button to reset some other page elements. What I need to do is to also have the reset button unhighlight or unselect the highlighted/selected row in the datatable. I have been unable to figure out what to do in my backing bean to get this working.

From my JSP page:

<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>

From my backing bean:

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

So I managed to figure out the solution to my problem. Im actually suprise no one was able to answer this.

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