Editor: how to display a string when field ist empty
Editor: how to display a string when field ist empty

I'm using editor in read-only display mode. Everything fine, but not with empty fields: I would like to display an information if the field ist empty instead of showing nothing, beeit a "-".
As far as I understood, editor does not support rendering fields - but how can it be done anyway?
Would be very nice if you could pass an idea!
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
https://editor.datatables.net/reference/option/fields.def
or
https://editor.datatables.net/reference/api/field().def()
@rf1234: Thanks for helping - but what I'm looking for ist not a default value.
I would like to display a string like 'no value' when a field is empty, but not change data (which is why a default as proposed does not help). Maybe the pic attached helps to explain:

use a getFormatter on the server that returns "---" if the field is empty and a setFormatter that returns NULL or an empty string if the field contains "---".
Alternatively client side - doing just the same thing:
Yes - as you note there are no renders for Editor on the client-side. So either you need to us a server-side renderer or set a value like @rf1234 says.
I think I'd probably take a slightly different approach though and use a custom field type plug-in for Editor that just will just display the data - not a disabled input as well. The read only display field can be used for exactly that. And you could put a condition into its
set
function that ifval
is an empty string, then write in the placeholder.Allan
Thanks a lot to @rf1234 and @allan !
Finally - with your help - I solved my problem by this:
(fields with strings analogously)
Looking good!
A long time ago I built these two formatters:
- getFormatter: returns date in local language format en-GB or de-DE.
- setFormatter: returns date in mysql dateTime format; input dates being en-GB or de-DE including long date formats.
The setFormatter doesn't need to know what the user's language is as long as it is German or UK English (won't work with American date formats though!)