primeng icon indicating copy to clipboard operation
primeng copied to clipboard

p-autocomplete highlight the existing text upon click

Open mengullojerome opened this issue 9 years ago • 3 comments

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

I can't figure out how to replicate this on the p-autocomplete component:

<input type="text" onclick="this.select()"/>

Also please note that the p-autocomplete is dynamically added.

Maybe there needs to be an enhancement for this.

Expected behavior The pre-existing text in the autocomplete should be highlighted.

Please tell us about your environment:

OS: Windows 7

Angular version: 2.3.1

PrimeNG version: 2.0.2

Browser: Chrome

Language: TypeScript 2.0.3

Node (for AoT issues): node --version = 6.0.42

mengullojerome avatar Sep 08 '17 13:09 mengullojerome

Issue is not clear.

cagataycivici avatar Oct 20 '17 11:10 cagataycivici

I'm wondering this too @cagataycivici I have a datatable that has quite a few rows in it and I want the existing contents of each cell to be highlighted when the cell comes into focus (clicked or tabbed intO). This will allow users to tab through the table without having to backspace and delete what's already in each cell. On a regular input type, this can be done as shown above with (click)="$event.target.select()"

I've tried several ways with the primeng datatable but haven't been successful. Is there any way to highlight existing text in an editable datatable when a cell is clicked?

jjacobs33589 avatar Nov 10 '17 17:11 jjacobs33589

Just in case you were still looking for an answer to this, or for future reference for other people, the above is do-able with the flowing code added to the element:

(onFocus)="$event.target.select()"

P.S. This is true on Angular 7 PrimeNG 7

miguellara78 avatar Feb 01 '19 07:02 miguellara78