Refresh problems with tr:tabel using a filter string defined in a tr_inputText
------------------------------------------------------------------------------

                 Key: TRINIDAD-1755
                 URL: https://issues.apache.org/jira/browse/TRINIDAD-1755
             Project: MyFaces Trinidad
          Issue Type: Bug
          Components: Components
    Affects Versions: 1.2.13-core 
         Environment: Trinidad 1.2.13, MyFaces 1.2.8, Tomahawk 1.1.9, Facelets 
1.1.15, Tomcat 6.0.20 
            Reporter: Markus Petri


In our application, we use a tr:inputText to filter the tables data using PPR.

1st problem:
When the filter method of the backing bean deliveres 1-4 matches, everything 
works fine. But if there are more than 5 matches, I need to press the button 
twice to get the table re-rendered.

2nd problem:
We use the rows attribute to show 10 entries each page. If the filter method 
deliveres more than 10 rows, I need also to click twice the "show next" link 
(but only the first time) to get to the next page. After the first click, I can 
switch the pages as purposed. 

Here our *.jspx (this *jspx is included into a <t:panelTabbedPane><t:panelTab> )
[...]
<tr:panelCaptionGroup captionText="#{resource['label.section.filteroptions']}" 
inlineStyle="margin-bottom:10px;">
 <table border="0" cellpadding="0" cellspacing="0">
 <tr>
  <td><tr:inputText id="filterString" 
        value="#{listing.filterString}" partialTriggers="cmd_reset" 
        styleClass="filterInput" 
        onblur="if(this.value == 
''){this.value='#{resource['text.filteroptions.default']}';this.style.color = 
'#A0A0A0';}" 
        onfocus="if(this.value == 
'#{resource['text.filteroptions.default']}'){this.value='';this.style.color = 
'#000000';}"
        
onkeyup="if(event.keyCode==13)document.getElementById('tab2:listForm:cmd_filter').click();"/>
  </td>
  <td>
   <tr:selectOneChoice value="#{listing.filterDate}"> 
    <f:selectItem itemLabel="#{resource['selectBox.choice.allRegistrations']}" 
itemValue="0"/>
    <f:selectItem 
itemLabel="#{resource['selectBox.choice.todaysRegistrations']}" itemValue="1"/>
   </tr:selectOneChoice>                                                        
  </td>
  <td><tr:commandButton id="cmd_filter" 
                  text="#{resource['button.filterList']}"
                  shortDesc="#{resource['tooltip.action.filterList']}"
                  actionListener="#{listing.filter}" partialSubmit="true" />
   </td>
   <td><tr:commandButton id="cmd_reset"
                  text="#{resource['button.filterReset']}"
                  shortDesc="#{resource['tooltip.action.reset']}"
                  blocking="true" 
                  actionListener="#{listing.reset}" partialSubmit="true"/>
   </td>
  </tr>
 </table>
</tr:panelCaptionGroup>
<tr:table binding="#{listing.table}" value="#{listing.regInfos}" var="regs" 
rowBandingInterval="1" rows="10" partialTriggers="::cmd_filter ::cmd_reset 
::pollid" immediate="true">
 <tr:column width="160" inlineStyle="vertical-align:top;" sortable="true" 
sortProperty="date">
  <f:facet name="header">
   <tr:outputText value="#{resource['table.registrations.plannedArrival']}"/>
  </f:facet>
  <tr:outputText value="#{regs.date}" id="date">
   <tr:convertDateTime pattern="#{resource['pattern.dateTime']}" type="both" /> 
                
  </tr:outputText>
 </tr:column>
 <tr:column width="100" inlineStyle="vertical-align:top;">
  <f:facet name="header">
   <tr:outputText value="#{resource['table.registrations.room']}"/>
  </f:facet>
  <tr:outputText value="#{regs.roomNumber}"/>
 </tr:column>
[...]

and the relevant part of the backing bean (using SESSION_SCOPE):
/**
 * Process the filter action.
 */
public void filter(ActionEvent e) {
        refreshTable();
}
public void refreshTable(){
        initialize();
        RequestContext.getCurrentInstance().addPartialTarget(getTable());
}                                               
private void initialize(){
        Authentication auth = 
SecurityContextHolder.getContext().getAuthentication();
        if (auth instanceof VirAuthenticationToken) {
                String login = ((VirAuthenticationToken)auth).getLogin();
                try {
                        setRegInfos(ServiceUtils.getOpenRegistrations(login, 
getDefaultSearchString().equals(getFilterString())? "" : 
getFilterString(),getFilterReriod()));
                }catch (RemoteException exc) {
                        log.fatal("Error processing business method - Remote 
error - " + ServiceManager.getInstance().getServiceExceptionMessage(exc));      
           
                }
        }
}

When debugging, it shows the same values both at the first and at the second 
click, but as told before the table is only re-rendered after the second click.

Any suggestions?

Thanks in advance,
 Markus


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to