jsf 2 - Is there a way to intercept a ExpansionToggle valueChange event before the client toggles the component? -


i using 3.3 version of icefaces , have data table of people. need expansion button allows user update attributes of person in data table. tag, ace:expansiontoggle 1 think can used, if catch events changelistener, client has toggled component. need validate fields in panel if validation fails, panelexpansion component won't close. here's code describe i'm trying do. binding component backing bean seemed idea if set breakpoint in getter , setter of expansiontoggle, client has collapsed panel before can it.

<ace:datatable id="driverlisttable" value="#{persons}" var="person">     <ace:column id="exp">         <ace:expansiontoggler              binding="#{personbean.expansiontoggle}"              changelistener="#{directdriverinfobean.handletoggleevent}"/>     </ace:column>      <ace:column headertext="#{msg.label_driver}">         <ice:outputtext value="#{person.firstname} #{person.lastname}"/>     </ace:column>      <ace:column styleclass="dobcolwidth" headertext="#{msg.label_dob}">         <ice:outputtext value="#{person.userdob}"/>     </ace:column>      <ace:column styleclass="drivercolwidth" headertext="marital status">         <ice:outputtext value="#{person.maritalstatus}"/>     </ace:column>      <ace:column headertext="person status">         <ice:outputtext value="#{person.status}"/>     </ace:column>      <ace:panelexpansion>         <show fields person here>     </ace:panelexpansion> <ace:datatable> 

what options have here?

thanks, patrick

i found out attribute 'statemap'. allows access each row in datatable. when click row, in 'handletoggleevent' method know row clicked on. validation , if fails, can check statemap row , force setexpanded(false)...

//add statemap attribute ace:datatable  <ace:datatable id="driverlisttable" value="#{persons}" var="person" statemap="statemap">  //added attribute currentrow can access row object.   <ace:column id="exp">     <ace:expansiontoggler          binding="#{personbean.expansiontoggle}"          changelistener="#{directdriverinfobean.handletoggleevent}">         <f:attribute name="currentrow" value="#{person}" />         <ace:expansiontoggler>    </ace:column>  //add following variable backing bean  /** row state map object allows access rows in data table. */    private rowstatemap statemap = new rowstatemap();  // edit handletoggleevent() method following:    public void handletoggleevent(expansionchangeevent event){       rowobject obj = event.getcomponent().getattributes().get("currentrow");//one way know row clicked.        //do validation        if(failed){         /*find row in state map.*/        rowstate rs = (rowstate) statemap.get(obj);          /*force not expanded*/        rs.setexpanded(false);       } 

}

hope works!


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -