Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    Date field not populating in grid filter when called using fetchdata

    Hi guys, I am trying to call fetchdata of list grid with the below criteria that we have stored in DB as json using below code.

    Code:
    AdvancedCriteria cr = grid.getFilterEditorCriteria();
    String jsonToSave = cr.toJSON();
    Below is the JSON which is stored in DB.
    Code:
    {
        "_constructor":"AdvancedCriteria",
        "operator":"and",
        "criteria":[
            {
                "operator":"and",
                "criteria":[
                    {
                        "fieldName":"needBy",
                        "operator":"greaterOrEqual",
                        "value":"2024-10-23"
                    },
                    {
                        "fieldName":"needBy",
                        "operator":"lessOrEqual",
                        "value":"2024-10-25"
                    }
                ]
            }
        ]
    }
    Re-constructing the advanced criteria on client from the above json.

    Code:
    final AdvancedCriteria savedCriteria = StringUtils.isNotEmpty(criteriaJson) ? new AdvancedCriteria(JSONEncoder.decode(criteriaJson)) : new AdvancedCriteria();
    getListGrid().fetchData(savedCriteria);

    These are date field in datasource.
    Code:
    <field name="needBy" nativeName="need_by" type="date"/>

    The fetch works but the date field is not populated in filter
    Click image for larger version

Name:	1.png
Views:	36
Size:	1.7 KB
ID:	273859

    I read about JSONDateFormat.LOGICAL_DATE_CONSTRUCTOR but I am not sure how to use it. Kindly suggest what am I missing here. Thanks in advance.


    Isomorphic


    #2
    Hi kamet4u,

    I'm pretty sure you got the criteria from a component the first place, but out if interest, what happens if you flatten the criteria string, so that they only have one "and"?

    Best regards
    Blama

    Comment


      #3
      hi kamet4u ,

      You didn't mention your version or build-date - we always need that information.

      From a quick test, however, we only see this issue in 13.1 and we've applied a fix - please retest with today's build, dated October 12, or a later one.

      Comment


        #4
        Thanks for the quick response. I forgot to mention the build. We are on build 13.0-p20231012.

        Comment


          #5
          A re-check showed this issue in 13.0 as well, and we've ported the fix - please retest with a 13.0 build dated October 19 or later.

          Comment

          Working...
          X