Documentation

Trace:

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

jvx:client:gui:celleditor_dateformat [2021/02/01 12:46]
admin created
jvx:client:gui:celleditor_dateformat [2021/02/01 13:39] (current)
admin
Line 2: Line 2:
 ~~Title: Change date format of Cell Editor~~ ~~Title: Change date format of Cell Editor~~
  
 +To set a custom date format on a date cell, simply use following code:
 +
 +<code java>
 +UIDateCellEditor dateEditor = new UIDateCellEditor();​
 +//use long pre-configured date format
 +dateEditor.setDateFormat(((SimpleDateFormat)SimpleDateFormat.getDateInstance(SimpleDateFormat.LONG)).toPattern());​
 +</​code>​
 +or use a custom format
 +<code java>
 +dateEditor.setDateFormat("​yyyy-MM-dd"​);​
 +</​code>​
 +
 +Above statements will create a date cell editor with configured date format. To apply the format, simply set the cell editor
 +
 +<code java>
 +databook.getRowDefinition().getColumnDefinition("​COLUMN_NAME"​).getDataType().setCellEditor(dateEditor);​
 +</​code>​
 +
 +It's not necessary to create multiple date cell editors for the same format, simply re-use existing instances. ​
 +
 +We have some static cell editors in our [[https://​sourceforge.net/​p/​jvx/​code/​HEAD/​tree/​trunk/​java/​library/​src/​javax/​rad/​application/​ApplicationUtil.java|ApplicationUtil]] class, e.g. 
 +
 +<code java>
 +IMAGE_VIEWER
 +</​code>​
 +We recommend that you create a utility class for your cell editors as well.
This website uses cookies for visitor traffic analysis. By using the website, you agree with storing the cookies on your computer.More information