Ajax for valueChangeListener

前端 未结 4 1846
礼貌的吻别
礼貌的吻别 2021-02-05 23:16

I\'m using the p:ajax listener to handle value change events (because valueChangeListener is launched on form submit):



        
4条回答
  •  攒了一身酷
    2021-02-06 00:04

    You could try the following:

    1. Implement the value change event in your bean

       public void processValueChange(ValueChangeEvent e){
       //foo the bar
       }
      
    2. Define a valueChangeListener on your selection component

       
      

      The key piece there is the submit() bit that processes the enclosing form on change of the value. You can then getNewValue() and getOldValue() as necessary.

    EDIT: Now that I think about it, I see no reason why you cannot leave your setup as-is and simply define the valueChangeListener. It should still be processed during the change event in the , in fact, it will be processed before the listener for the ajax event itself.

提交回复
热议问题