Announcement

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

    ListGrid filter not working when final character deleted

    I have a ListGrid (for selecting things) with filtering that needs to exclude records from another ListGrid (showing what's been previously selected).
    I create a criteria using NOT_IN_SET on the previously selected item IDs, and pass that to the selection grid.
    The selection grid successfully excludes the previously selected items, but filtering has a problem.
    Filtering works as I type characters. It works as I delete characters until I delete the last character.
    Deleting the last character doesn't trigger the filter, so the displayed items remains the same as when it had one character.

    I've tried a variety of things, shown below, but so far no luck.
    What am I missing?

    Here's how I create the grid...
    Code:
       private static ListGrid createGrid(Criteria crit) {
           final ListGrid grid = new ListGrid();
           grid.setDataSource("MyDataSource");
           grid.setWidth100();
           grid.setHeight100();
    //        grid.setInitialCriteria(crit);// <-- no filter on final char delete (one or more char OK)
    //        grid.setCriteria(crit);// <-- no filter on final char delete (one or more char OK)
    //        grid.setFilterEditorCriteria(crit);// <-- no data initially, filters but crit is ignored.
    //        grid.getFilterEditor().setInitialCriteria(crit);// <-- gets an error on `getFilterEditor()`
    //        grid.setFilterByCell(true);// <-- no effect on issue - e.g. with `setInitialCriteria(crit)`
           grid.setAutoFetchData(true);
           grid.setShowRollOver(true);
           grid.setFilterOnKeypress(true);
           grid.setLeaveScrollbarGap(false);
    
           return grid;
       }
    Here's how I create the criteria...
    Code:
       private static Criteria createFilterCriteria(ListGrid grid) {
           ListGridRecord[] records = grid.getRecords();
           String[] ids = new String[records.length];
           for (int i = 0; i < records.length; i++) {
               ListGridRecord r = records[i];
               String id = r.getAttribute("id");
               ids[i] = id;
           }
    
           Criteria c = new Criterion("id", OperatorId.NOT_IN_SET, ids);
    
           return c;
       }
    Thanks,
    -chris

    SmartClient Version: v11.0p_2016-08-09/Enterprise Deployment (built 2016-08-09)
    FireFox 57.0.2

    #2
    You are a year and a half behind on patches, so start there. If you still have the problem after getting up to date, turn on the "ResultSet" log category for more information.

    Comment


      #3
      Just following up. Tested this with version 6.1-920180103 and could not reproduce the issue.

      Comment

      Working...
      X