How to ajax update an item in the footer of a PrimeFaces dataTable?

后端 未结 1 1652
一个人的身影
一个人的身影 2020-12-10 00:05

This is a visual of the table I have:

+---------+------------+-------------------+
| Header1 |  Header2   | Header3           |
+---------+------------+----------         


        
1条回答
  •  再見小時候
    2020-12-10 00:19

    You can't really update the values of the table from within the table. However, you can use p:remoteCommand to achieve this. Also, I would probably use the cellEdit event on the whole table (instead of a single p:ajax on your pe:inputNumber). The overall result would be:

    
    ...
    
    
        
            
        
    
        
            
                
            
        
    
        
            
        
    
        
            Total:
            
        
    
    
    

    Please note that you might need to add partialSubmit="true" to the p:ajax, this way you only submit the component's data. If you like the cellEdit event idea, you need to make the dataTable editable, and add the following in your p:dataTable, and get rid of the p:ajax inside your pe:inputNumber

    
    

    Good luck!

    0 讨论(0)
提交回复
热议问题