Announcement

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

    ListGrid's FilterPanel's ComboBoxItem filter force reload data from server

    Dear Isomorphic,

    I have a problem with ListGrid's FilterPanel's ComboBoxItem type filters. I need to force reload/fetch list data from server.
    I tried:
    - to call invalidateCache on the FilterBuilder's DataSource's (getFilterPanel().getDataSource().invalidateCache()).
    - to set the DataSource setCacheAllData to false.

    Have any method to do that?

    Version: 12.0-p20190527

    Thank you.
    Best Regards,
    Gábor

    #2
    Hi Walron,

    please see this post where I have the same issue and the linked SelectItem.setCachePickListResults() and ComboBoxItem.setCachePickListResults().
    I did not investigate/test further myself, though.

    Best regards
    Blama

    Comment


      #3
      Isomorphic,

      the SelectItem docs don't include the hint ComboBoxItem has:
      Note that this does not control re-use of data within a single pickList. To control when client-side filtering is used in ComboBoxItem, see useClientFiltering and filterLocally.
      Walron: From those docs it seems that setting useClientFiltering:false is enough to solve this case.

      Other option I already thought of before (a bit hackish) would include a fake .ds.xml-field with customSelectExpression="0" and a notEqual criteria with a random number.

      Best regards
      Blama

      Comment


        #4
        Hello Blama

        Thank you for the help. I try the setUseClientFiltering(false) and the setCachePickListResults(false) too but not working.

        In my project I need to refresh or drop cached lookup filters datas for a button press.

        My FilterPanel DataSource lookup DataSourceField looks like this:
        Code:
            private DataSourceField getLookupField(String dataFetchURL, ElementDefinition elementDefinition) {
                DataSourceField dsField = new DataSourceTextField(elementDefinition.getElementName(), elementDefinition.getElementTitle());
        
                GenRestDataSource selectDS = new GenRestDataSource(elementDefinition.getElementLookupDS());
                DataSourceTextField keyField = new DataSourceTextField(elementDefinition.getElementLookupId());
                keyField.setPrimaryKey(true);
                keyField.setHidden(true);
                DataSourceTextField displayField = new DataSourceTextField(elementDefinition.getElementLookupDisplay());
                displayField.setEscapeHTML(true);
                selectDS.setFields(keyField, displayField);
                selectDS.setDataURL(dataFetchURL);
        
                final ComboBoxItem comboBoxItem = new ComboBoxItem(elementDefinition.getElementName());
                comboBoxItem.setOptionDataSource(selectDS);
                comboBoxItem.setValueField(elementDefinition.getElementLookupId());
                comboBoxItem.setDisplayField(elementDefinition.getElementLookupDisplay());
                comboBoxItem.addKeyPressHandler(this::clearByEscKeyPressHandler);
        
        // This is what I try - start
                comboBoxItem.setUseClientFiltering(false);
                comboBoxItem.setCachePickListResults(false);
        // This is what I try - end
        
                dsField.setEditorProperties(comboBoxItem);
                dsField.setValidOperators(OperatorId.EQUALS, OperatorId.STARTS_WITH, OperatorId.CONTAINS, OperatorId.IEQUALS, OperatorId.ISTARTS_WITH, OperatorId.ICONTAINS,
                        OperatorId.NOT_EQUAL, OperatorId.NOT_STARTS_WITH, OperatorId.NOT_CONTAINS, OperatorId.INOT_STARTS_WITH, OperatorId.INOT_CONTAINS, OperatorId.IS_NULL,
                        OperatorId.NOT_NULL);
                return dsField;
            }
        The ElementDefinition is a class for the filter field parameters.
        The GenRestDataSource is extends RestDataSource (we override a bit the transformRequest methode).

        Best regards
        Gábor
        Last edited by Walron; 13 Jun 2019, 04:44.

        Comment


          #5
          Isomorphic,

          the hint I mention in #3 is still missing in the SelectItem docs. I think that it will help here as well.

          Best regards
          Blama

          Comment

          Working...
          X