views:

1607

answers:

2

Hello,

I am using Richfaces 3.3.0, Facelelts 1.1.14 and Seam 2.1.1.

I have an issue my rich:dataTable component and sorting. I noticed a pattern... the very first click on the table on a column header has no effect then all subsequent clicks on any header actually performs previously requested order. I tried many different things, but I can't point at what might be causing this which makes it difficult to address the issue. I would really appreciate some help.

The section of my .xhtml file that contains the table looks like this:

 <rich:contextMenu attached="false" id="menu" submitMode="ajax">

      <rich:menuItem ajaxSingle="true" action="#{myAction.openItem}" value="Open Report" >

           <a4j:actionparam name="uri" assignTo="#{myAction.selectedItem.uri}" value="{uri}"/>

      </rich:menuItem>

      <rich:menuItem submitMode="server" action="#{myAction.openItem}" value="Open in new window" target="{uri}" onclick="window.open('', 'jsWinId', 'windth=200, height=200, resizable=0')">

           <a4j:actionparam name="uri" assignTo="#{myAction.selectedItem.uri}" value="{uri}"/>

      </rich:menuItem>

 </rich:contextMenu>


 <rich:dataTable id="myTable" var="_myItem" value="#{myAction.allItems}" selectionMode="single" sortMode="single" width="100%" rows="25"  reRender="myForm:myTable,ds" rowClasses="cur" onRowMouseOver="this.style.backgroundColor='#F1F1F1'" onRowMouseOut="this.style.backgroundColor='#{a4jSkin.tableBackgroundColor}'" rendered="#{not empty myAction.allItems}" >

      <rich:column id="col1" sortBy="#{_myItem.id}" sortOrder="#{myAction.sortOrder['col1']}" label="Transaction ID" width="15%">

           <f:facet name="header">

                <h:outputText value="ID"/>

           </f:facet>

           #{_myItem.id}

      </rich:column>

      <rich:column id="col2" sortBy="#{_myItem.category}" sortOrder="#{myAction.sortOrder['col2']}" label="Category" width="17%">

           <f:facet name="header">

                <h:outputText value="Category"/>

           </f:facet>

           #{_myItem.category}

      </rich:column>

 <rich:column id="col3" sortBy="#{_myItem.name}" sortOrder="#{myAction.sortOrder['col3']}" label="Name" width="17%">

      <f:facet name="header">

           <h:outputText value="Name"/>

      </f:facet>

      #{_myItem.name}

 </rich:column>

 <rich:column id="col4" sortBy="#{_myItem.location}" sortOrder="#{myAction.sortOrder['col4']}" label="Location" width="21%">

      <f:facet name="header">

           <h:outputText value="Location"/>

      </f:facet>

      #{_myItem.location}

 </rich:column>

 <rich:column id="col5" sortBy="#{_myItem.status}" sortOrder="#{myAction.sortOrder['col5']}" label="Status" width="15%">

      <f:facet name="header">

           <h:outputText value="Status"/>

      </f:facet>

      #{myAction.statusDescription(_myItem.status)}

 </rich:column>

 <rich:column id="col6" sortBy="#{_myItem.timestamp}" sortOrder="#{myAction.sortOrder['col6']}" label="Timestamp" width="15%">

      <f:facet name="header">

           <h:outputText value="Timestamp"/>

      </f:facet>

      <h:outputText value="#{_myItem.timestamp}"><s:convertDateTime type="both" pattern="yyyy-MM-dd HH:mm:ss.ss"/></h:outputText>

 </rich:column>



 <f:facet name="footer">

      <rich:datascroller for="myTable" id="ds" renderIfSinglePage="false" ajaxSingle="false"></rich:datascroller>

 </f:facet>



 <rich:componentControl event="onRowClick" for="menu" operation="show">

      <f:param name="uri" value="#{_myItem.uri}"/>

 </rich:componentControl>

Thanks in advance!

A: 

Remove the reRender attribute of the dataTable.

See here for example of usage.

Also, rich:dataTable doesn't have a selectionMode attribute.

I'd suggest making it work with a minimal set of attributes and tags (i.e. copy-paste the example), and then adding the ones you need, one by one, to identify where the problem comes from.

Bozho
Thanks for the reply. I removed the reRender attribute but it still doesn't work.Note, I solved the datascroller issue by specifying its page attribute. Per the documentation: "The "page" is a value-binding attribute used to define and save current page number."As to the sorting it seems to be that it fails to reRender the page components properly after an AJAX request. In fact I found that refreshing with F5 after the the first request which appears to have no effect, actually displays the table data in the expected order. Any thoughts?
Mitchi
I did as you suggested, also tried the newer 3.3.2 version of richFaces. but it did not solve the issue. Sorting does not rerender the table data until refreshed or the next request...
Mitchi
A: 

Is this in a conversational component, and the conversation is definitely started?

bravocharlie