Primeng: Add closeCellEdit method to Table

Created on 16 Mar 2018  路  5Comments  路  Source: primefaces/primeng

[ ] bug report
[x] feature request
[ ] support request

Current behavior
Not able to close edit mode in p-table programmatically for instance by calling a method. Cell input mode can only be closed by pressing return or Esc.

Expected behavior
Would be nice to exit the cell edit mode by calling a method or firing some event.

  • Angular version: 5.6.0
  • PrimeNG version: 5.2.3
  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
  • Language: [all | TypeScript X.X | ES6/7 | ES5]
new feature

Most helpful comment

Added closeCellEdit

All 5 comments

Workaround:

you could use this function with a button in the edit template:

Tempalte

<p-table #dt ...
...
<p-cellEditor>
    <ng-template pTemplate="input">
          ...
          <button (click)="stopEdit($event)">OK</button>          
    </ng-template>
    <ng-template pTemplate="output">
          ....
    </ng-template>
</p-cellEditor>
...

Controller

...
@ViewChild('dt') dt: Table;
stopEdit(event) {
    event.stopPropagation();
    $(this.dt.editingCell).removeClass('ui-editing-cell');
    this.dt.onEditComplete.emit({ field: null, data: null });
    this.dt.editingCell = null;
 }
...

Added closeCellEdit

Could we have thiss closeCellEditmethod in the new TreeTable aswell?

This needs to be reopened, it has regressed https://github.com/primefaces/primeng/issues/7055

I am unable to find this function

Was this page helpful?
0 / 5 - 0 ratings

Related issues

mitosandov picture mitosandov  路  3Comments

cyberrranger picture cyberrranger  路  3Comments

markgoho picture markgoho  路  3Comments

pchristou picture pchristou  路  3Comments

philly-vanilly picture philly-vanilly  路  3Comments