In my Jspresso application, I have an entity with startDate
and endDate
.
I've created a filter module on this entity with a search on a validityDate
that the user has to type in. The generated query should return the list of entities for which this validityDate
is between startDate
and endDate
.
So I customized the query and this works well.
Unfortunately, the filter view displays the validityDate
field preceeded by a search operator (<
,>
, between
…) which is irrelevant in my case; so I simply ignore the operator in the query.
I would like to hide the operator in the view to only have the date with a date picker.
I don't think it can easily be achieved using the current Jspresso version (4.0.7 as of now). The problem is that the code responsible for exploding the comparable scalar properties into a (comparator, min, max) filtering structure is too deeply nested for it to be overridden using dependency injection :
The following method :
is located into the
RefQueryComponentDescriptor
class whose instances are constructed at runtime by theBasicQueryComponentDescriptorFactory
but in a private method (i.e.createOrGetQueryComponentDescriptor
). So even if you could inject your own customized instance ofBasicQueryComponentDescriptorFactory
, you would have to copy/paste too much code to reach theisPropertyFilterComparable
method.Since your use case is perfectly valid, I suggest that you create an enhancement request on the Jspresso GitHub.
A little less straightforward but more versatile approach might be to open the various comparable properties (number, date, time and duration) for an extra customization in order to tell Jspresso whether to generate or not the comparator structure when those properties are added in a filter view.
something like :
But this would require a change in the SJS DSL.