Open nsenave opened 2 years ago
This would be achievable with custom serializer/deserializer for BodyCell objects.
Yet, a better solution would be to define an interface, and make objects that can be held in a a table implement it, and use these objects (subclassses of ComponentType, LabelType etc.) directly in tables.
Table cells are modeled using a
BodyLine
object.This objects is design to represent components that are in the table.
It has
min
andmax
attributes of typedouble
. This fits the"InputNumber"
type of component.Unfortunately,
"Datepicker"
component also havemin
andmax
attributes, but ofString
type.Thus is it impossible to set the
min
andmax
attribute forBodyLine
objects that represent a"Datepicker"
component.As far as I know, this property is not used in the Lunatic library yet, so it's not a big deal for now.
I don't see an easy quick solution to this since attribute names are the same (even there should be a workaround to do it).
A better solution would to use polymorphism instead of the
BodyLine
object to put proper components in table cells.This would also improve the modeling of tables. For instance, Lunatic-Model allows to create a component of type
"InputNumber"
and set it amaxLength
, which would be invalid for Lunatic.