0

I am using angular 4 and PrimeNg datatable with editing, is it possible to force the upper case in 1 column when user is writing? maybe calling toUpperCase on keyup? or something better

Alessandro Celeghin
  • 4,039
  • 14
  • 49
  • 95
  • @Pijotrek how java, filesystems and so on is connected to my question – Alessandro Celeghin Aug 30 '17 at 13:53
  • I am so sorry, I must have had two tabs with two other questions opened. Deleting that comment right away. Sorry again! – Pijotrek Aug 30 '17 at 14:05
  • Do you mean making text uppercase in cell that user is editing or some other cell? If you want to format text that is in edit mode you could add css styling to input element inside cell. Did not try this out but could be something like this: .ui-cell-editing .ui-inputtext { text-transform: uppercase; } – sharko Aug 30 '17 at 14:56
  • I want that the value that user is writing to be converted in uppercase when is writing, the real value not only the view – Alessandro Celeghin Aug 30 '17 at 15:04
  • If you don't need it to be converted, but just in the end, you could use onBlur and just capitalize the value. – SaxyPandaBear Aug 30 '17 at 15:28
  • how can I use onBlur inside primeng column? – Alessandro Celeghin Aug 30 '17 at 15:36

1 Answers1

0

Why not use an editor template with an (ngModelChange) function to convert the value to uppercase

Look at the datatable demo showing the use of the editor template. Notice how the template uses an [(ngModel)]? Change that to an [ngModel]="yourModel" and add (ngModelChange)="yourFunction(event)"

PrimeNG DataTable editable example

BillF
  • 804
  • 10
  • 20