valuechangelistener getting called multiple time

844 Views Asked by At

I'm working on icefaces upgrade from 1.8 to 3.3 as well as jsf from 1.2 to 2.0.

I have used this link as reference for icefaces upgrade

I'm using ice:datatable in which I have column of checkbox which is grouped for single worker.Check picture which is of before upgrade.

ISSUE 1: Now Problem faced after migration is that the valuechangelistener of ice:selectbooleancheckbox works fine when I check then uncheck the checkbox of a single worker. But when I do following steps:

  1. Check first worker (This updates the Assigned door column ).
  2. Then check other worker . This unchecks the previous checked worker and also unchecks currently checked worker.

To analyse if there is any issue in phase I used balus C blog to check phase of icefaces when it hits valuechangelistner . Then I found on my second check 2 or more valuechangelistner are called one for previous worker other for current worker(Sometimes twice) this all happens in same invoke application phase.

ISSUE 2: ValueChangeListener gets called even after Clicking "OK" button or "CANCEL". Fixed it by adding f:param in ice:commandButton and checking for the param in valuechangelistener method.

Tried:

  1. To change all ice tags in the page to ace tags(Related to datatable i.e datable ,row and column).

Result : Same issue with ace valuechangelistener as well as distorted style. Maybe because I could not find ice:rowHeader equivalent in ace tags and also much more.

  1. Changed only checkbox column to ace:column. Valuechangelistener worked fine but issue with "groupOn" attribute so changed it to "groupBy" and condition="group" still may be it did not work because I used ice:datatable which doesn't support it.

  2. Then I tried to implement groupOn functionality manually. Using rowspan and rendering single checkbox for single worker . But rowspan didn't work. Also when I tried to render checkbox, its style is not exactly same as I need. Check this hattp://postimg.org/image/ih2mgoh7d/ remove 'a' from 'hattp'.

     <ace:column groupBy ="#{item.workerName} + #{item.workerId}" rowspan="2" 
                            styleClass= "alignSBChbx" >
                            <ice:setEventPhase events="ValueChangeEvent"
                                       phase="INVOKE_APPLICATION">
                            <ice:selectBooleanCheckbox id="dwaCheckbox"  value="#{item.select}" 
                           style=" width:'#{appViewSettings.checkboxSize}';
                            height:'#{appViewSettings.checkboxSize}';" 
                            valueChangeListener="#{dockWorkerAssignmentBean.doorAssignmentChange}" 
                            partialSubmit="true" immediate="true" 
                            disabled="#{!empty dockWorkerAssignmentBean.errorMap['dockWorkersAssignmentPopup:assignmentErrorField']}"
                            rendered="#{item.visible}">
                            <f:attribute name="workerIdSelected" value="#{item.workerId}" />
                            <f:attribute name="assignmentIdSelected" value="#{item.assignmentId}" />
                            </ice:selectBooleanCheckbox>
    
                            </ice:setEventPhase>
                            </ace:column>
    
    
    
    
    
    
      backend
      public final void doorAssignmentChange(final ValueChangeEvent event) {
    System.out.println("inside door Assignment...");
    
    
      final String workerIdSelected = (String) event.getComponent().getAttributes().get(
            "workerIdSelected");
     // unrelevant code
    
     }
    

    }

0

There are 0 best solutions below