Creating a filter view in Jspresso containing a date picker without comparison operators

Benoît VALLETTE d'OSIA

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.

Vincent Vandenschrick

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 :

protected boolean isPropertyFilterComparable(
      IPropertyDescriptor propertyDescriptor) {
    return propertyDescriptor instanceof INumberPropertyDescriptor
        || propertyDescriptor instanceof IDatePropertyDescriptor
        || propertyDescriptor instanceof ITimePropertyDescriptor
        || propertyDescriptor instanceof IDurationPropertyDescriptor;
}

is located into the RefQueryComponentDescriptor class whose instances are constructed at runtime by the BasicQueryComponentDescriptorFactory but in a private method (i.e. createOrGetQueryComponentDescriptor). So even if you could inject your own customized instance of BasicQueryComponentDescriptorFactory, you would have to copy/paste too much code to reach the isPropertyFilterComparable 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 :

date 'validityDate', filterComparable:true

But this would require a change in the SJS DSL.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Creating a filter view in Jspresso containing a date picker without comparison operators

From Dev

Creating a Custom Picker View

From Dev

Creating a Custom Picker View

From Dev

Manipulate the date picker view

From Dev

Date Picker Layout View

From Dev

Effect of creating an Exclude Filter without selecting a view(s)

From Dev

Effect of creating an Exclude Filter without selecting a view(s)

From Dev

How to filter a query string with comparison operators in Express

From Dev

android calendar view date picker

From Dev

Change comparison operators without large conditional block

From Dev

Logical comparison operators without control statements

From Dev

how to filter data by using date picker

From Dev

Date Picker View Super Small - Swift Xcode

From Dev

Date range picker in Ember.view

From Dev

Mongodb : Why convert string date to ISOdate if comparison operators work?

From Dev

Creating Action Links Without A View

From Dev

Marklogic date comparison in XQuery with or without index

From Dev

PHP/MySQL Date and Time comparison (without seconds)

From Dev

page view counter filter by date

From Dev

How to make date picker appear on button click as date picker is in top bar of view controller

From Java

iOS 7 - How to display a date picker in place in a table view?

From Dev

jQuery bootstrap date range picker with months only view mode

From Dev

How to add Date Picker in Horizontal paging scroll view?

From Dev

Calendar view in not updated for initial value in bootstrap date range picker

From Dev

How to add Date Picker in Horizontal paging scroll view?

From Dev

jquery date picker set date format as 'MM-DD-YYYY' from a string containing datetime

From Dev

creating custom views without an extra view hierarchy

From Dev

View archive menu without creating archive

From Dev

Django Test: Test view without creating client

Related Related

  1. 1

    Creating a filter view in Jspresso containing a date picker without comparison operators

  2. 2

    Creating a Custom Picker View

  3. 3

    Creating a Custom Picker View

  4. 4

    Manipulate the date picker view

  5. 5

    Date Picker Layout View

  6. 6

    Effect of creating an Exclude Filter without selecting a view(s)

  7. 7

    Effect of creating an Exclude Filter without selecting a view(s)

  8. 8

    How to filter a query string with comparison operators in Express

  9. 9

    android calendar view date picker

  10. 10

    Change comparison operators without large conditional block

  11. 11

    Logical comparison operators without control statements

  12. 12

    how to filter data by using date picker

  13. 13

    Date Picker View Super Small - Swift Xcode

  14. 14

    Date range picker in Ember.view

  15. 15

    Mongodb : Why convert string date to ISOdate if comparison operators work?

  16. 16

    Creating Action Links Without A View

  17. 17

    Marklogic date comparison in XQuery with or without index

  18. 18

    PHP/MySQL Date and Time comparison (without seconds)

  19. 19

    page view counter filter by date

  20. 20

    How to make date picker appear on button click as date picker is in top bar of view controller

  21. 21

    iOS 7 - How to display a date picker in place in a table view?

  22. 22

    jQuery bootstrap date range picker with months only view mode

  23. 23

    How to add Date Picker in Horizontal paging scroll view?

  24. 24

    Calendar view in not updated for initial value in bootstrap date range picker

  25. 25

    How to add Date Picker in Horizontal paging scroll view?

  26. 26

    jquery date picker set date format as 'MM-DD-YYYY' from a string containing datetime

  27. 27

    creating custom views without an extra view hierarchy

  28. 28

    View archive menu without creating archive

  29. 29

    Django Test: Test view without creating client

HotTag

Archive