Announcement

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

    No fetch requests after ListGridField#setFilterEditorProperties

    Hi,

    i want to set a MiniDateRangeItem filter editor for listGrid fields which have not the DATE type. I do
    Code:
    listGridField.setFilterEditorProperties([B]new [/B]MiniDateRangeItem());
    for these fields and finally
    Code:
    listGrid.setFields(listGridFields);
    This works in the UI, the MiniDateRangeItem is visible in the filter bar, it can be opened and I can choose date ranges. However, after clicking "ok" with entered "From:" and/or "To:" values, no fetch requests are processed anymore. I have my own datasource for this listGrid and DataSource#transformRequest() is not called anymore. Not when clicking on the filter button, or when entering a filter string into the filter text item for another field in the listGrid and pressing enter.
    Only when changing the sort order, transformRequest() is called. In this case the DSRequest contains also an AdvancedCriteria object for the field as expected.

    Am I missing something, or do I have to override another method in the DataSource?

    Thanks for help.

    SmartClient Version: v11.1p_2017-07-03/LGPL Development Only (built 2017-07-03)
    Chrome Version 65.0.3325.181

    #2
    It doesn't make sense to use a MiniDateRangeItem or other date controls on a field that is not of type "date" (or "datetime"). There is no meaningful way for these controls to form criteria or edit non-dates.

    We're not sure why you would attempt this - perhaps legacy date formats? .. and we can't offer further advice until you explain what you hoped would happen here.

    Comment


      #3
      There is no meaningful way for these controls to form criteria or edit non-dates.
      I already get the criteria in the DSRequest and this is as expected. But only after changing the sorting order. And I do not want to edit something, this is only about filtering.

      The values in the field are strings each representing a date. I use dsRequest.getCriteria() in DataSource#transformRequest() to get the AdvancedCriteria, translate it into my own criteria object, and parse the field string for each record in the listGrid into java.util.Date to match it against the criteria and filter the records.

      Everything is already working except my problem described in my first post, so I don't think the actual type of field values is important here.

      I also tried
      Code:
      listGridField.setFilterEditorType(MiniDateRangeItem.[B]class[/B]);
      and
      Code:
      listGridField.setType(ListGridFieldType.[B][I]DATE[/I][/B]);
      both also with the same faulty behavior. The MiniDateRangeItem is there but after entering date ranges and clicking "ok", there are no calls to DataSource#transformRequest() when clicking on the filter button.

      Comment


        #4
        This behavior is not faulty, and partial functionality does not indicate your approach is supported. Again, switch the field type to date, and arrange for the data to be delivered as actual dates. This filtering issue is just one of many things that will go wrong if you deliver bad data or try to use controls with the wrong field types.

        Comment


          #5
          I solved it with
          Code:
          listGrid.addFilterEditorSubmitHandler(event -> listGrid.fetchData(event.getCriteria()));
          I know this is ugly and not as intended but everything is working now.

          Comment

          Working...
          X