I'm submitting a ... (check one with "x")
[ ] bug report => Search github for a similar issue or PR before submitting
[X] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35
Current behavior
Currently TurboTable in PrimeNG has ability to enable edit mode by adding pEditableColumn directive into table cell and using p-cellEditor to create suitable template for preview and edit view.
By default, only way to enter edit mode is single click.
Expected behavior
Add attribute or event to enable edit mode programatically, for example after double click.
What is the motivation / use case for changing the behavior?
It should extend functionalities of TurboTable.
I would like to recommend this feature
I also think this feature is very interesting. It will give a lot of added value to the component
Edit on double click would be great, it would allow users to select the row on single click, for example if that action then caused other events to fire off, and then a double click to edit.
We also want to use double click for edit mode, because we use single click for cell selection. Right now my collegue hacked it like this:
Create a onCellClick event where we set this.treeGrid.editingCell to null to prevent single click from going into edit mode:
@ViewChild('treeGrid') treeGrid: TreeTable;
public onCellClick(row: string, col: string): void {
this.treeGrid.editingCell = null;
}
Added onCellClick and dvmTreegridEditColumn directive to our <td>:
<td
class="cell"
*ngFor="let col of columns; let i = index"
(click)="onCellClick(rowData['id'], col.colId)"
ttEditableColumn
vmTreegridEditColumn
>
The directive that 'clicks' the cell on the dblclick event:
import { Directive, HostListener } from '@angular/core';
import { TTEditableColumn } from 'primeng/treetable';
@Directive({
selector: '[vmTreegridEditColumn]'
})
export class TreegridEditColumnDirective {
constructor(private _column2Edit: TTEditableColumn) { }
@HostListener('dblclick', ['$event'])
onDblClick(e: MouseEvent) {
this._column2Edit.onClick(e);
}
}
It's not pretty and we are probably going to refactor it, but for now this works. We would very much like to see the ability to use double click or any other event to become a standard feature.
[edit] If it matters: we are using a p-treeTable, not the p-table.
Most helpful comment
Edit on double click would be great, it would allow users to select the row on single click, for example if that action then caused other events to fire off, and then a double click to edit.