Updating entire

on complete of

前端 未结 5 1810
旧巷少年郎
旧巷少年郎 2020-11-30 02:01

I am having difficulty re-rendering a PrimeFaces Datatable once a cell has been edited. Changing the value in one cell may change entries in the other cells, hence the need

5条回答
  •  感情败类
    2020-11-30 02:25

    After 5 years, this problem still exists. Unfortunately, while Baukes solution is extremly helpful and includes important insights it's still incomplete, as ltlBeBoy already pointed out in his comment. Subsequent edits without change lead to an inconsistent table state, where no more edits are possible. The reason is, that the oncomplete remote update comes after the edit mode of the new cell is already activated. So the edit mode of the new cell is destroyed by the update. However, the update can't be done in Ajax listener tableBean#onCellEdit, as this would display the table erroneously with one cell only.

    The solution is, to execute the update in the remote commands listener and only, if a change happend. So, in tableBean you implement a programmatic update, a remote listener and a flag that indicates change:

    public static void update(String id) {
       PrimeFaces pf = PrimeFaces.current(); //RequestContext.getCurrentInstance() for 

    The remote command has no update attribute any more:

    
    

提交回复
热议问题