Announcement

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

    Filtering not working with Criteria in ComboBoxItem

    Hi ,

    We are facing issues in filtering the data in combo box item picklist , when we are fetching picklist data with criteria , filtering is not working.
    Filtering is working fine if we don't use criteria while fetcing the data. And it's just doing the case sensitive highlight/search.

    ComboBoxItem prepTypeEditor = (ComboBoxItem) getCellEditor(DataSourceConstant.DROPDOWN_DS,
    DataSourceFieldsConstant.CODE_1, "fetchPrepTypeByCodeId90");
    Criteria pickListCriteria =new Criteria();
    pickListCriteria.addCriteria("itemno","abc");
    prepCodeEditor.setPickListCriteria(pickListCriteria);

    #2
    Thanks for the notification. We are aware of some issues around ComboBoxItem filtering in conjunction with criteria and will be making some changes soon.
    We'll make sure this gets addressed and follow up here when the change is in.

    One question: Which build are you seeing this on?

    Thanks
    Isomorphic Software

    Comment


      #3
      We are using '6.1-p20190721' version.

      Comment


        #4
        Oh - that's interesting - we actually would not expect our recent changes in this area to have any impact on the 6.1p branch, as all changes have been on 12.x
        So you're probably hitting some separate problem.

        Could you share a runnable test case? The snippet you have and description is a little thin for us to fully grasp what's going on and to fix the issue we probably need to see it in action.

        It should be straightforward to take one of the shipped samples (built-in ds, for example) and create a new simple EntryPoint class with a ComboBoxItem that demonstrates the problem (bound to the shipped DataSource in that sample).
        If you can share that class and the steps to reproduce we should be able to get to the bottom of this rapidly

        Regards
        Isomorphic Software

        Comment


          #5
          Hi ,

          Below is the code snippet



          private ListGrid prepsGrid;

          private void addGridColumnEditors() {

          ComboBoxItem fieldOne;
          prepTypeEditor = (ComboBoxItem) getCellEditor("Dropdown", "type", "fetchFieldOne");
          prepTypeEditor.setAutoFetchData(false);



          ListGridField field1 = new ListGridField("code_1", "Code");
          ListGridField field2 = new ListGridField("description", "Description");

          ComboBoxItem dependentField= (ComboBoxItem) getCellEditorWithPickListFields(DataSourceConstant.DROPDOWN_DS,
          DataSourceFieldsConstant.CODE_1, DataSourceConstant.DEFAULT_OPERATION_ID, field1, field2);

          handleDynamicCriterias(fieldOne);

          }



          private void handleDynamicCriterias(ComboBoxItem fieldOne) {
          fieldOne.setPickListFilterCriteriaFunction(itemContext -> {
          Criteria criteria;
          int rowNum = prepsGrid.getRowNum(prepsGrid.getSelectedRecord());
          String prepTypeStr = (prepsGrid.getEditValue(rowNum, "fieldOneType") != null) ?
          (String) prepsGrid.getEditValue(rowNum, "fieldOneType") :
          prepsGrid.getSelectedRecord().getAttributeAsString("fieldOneType");

          criteria = new Criteria("fieldOneId", "1");

          return criteria;
          });

          }

          Comment


            #6
            This isn't a standalone runnable example. It calls methods you haven't included here, referenced constants and a dataSource not present, and there's no code to actually write the generated comboBoxItem out into a ListGrid or a form.

            Since we can't run your test case, we went through the process of putting together a simple standalone test case to see if setPickListFilterCriteriaFunction() was just broken in 6.1
            It appears to be working fine.
            Here's our test case. You can drop this into a new EntryPoint class in the Built-In DS sample, as we suggested, to see it in action.

            It seems likely there's some other application bug in your usage which is causing the filtering to fail for you, but if you think there's a framework problem, we'd recommend modifying the starting point below to demonstrate the problematic usage sharing the result with us.
            This will give us a runnable test case / complete set of code which we can meaningfully debug.

            Thanks and Regards
            Isomorphic Software

            Code:
            public class ComboCriteria61Issue implements EntryPoint {
            
                @Override
                public void onModuleLoad() {
                    DataSource supplyItem = DataSource.get("supplyItem");
            
                    ComboBoxItem fieldOne = new ComboBoxItem("foo");
            
                    fieldOne.setOptionDataSource(supplyItem);
                    fieldOne.setValueField("SKU");
                    fieldOne.setDisplayField("itemName");
            
                    fieldOne.setPickListFields(new ListGridField("itemName"), new ListGridField("units"));
            
                    fieldOne.setPickListFilterCriteriaFunction(itemContext -> {
                        Criteria criteria = new Criteria("units", "Ea");            
                        return criteria;
                    });
            
                    DynamicForm testForm = new DynamicForm();
                    testForm.setFields(fieldOne);
                    testForm.draw();
            
                }
            
            }

            Comment

            Working...
            X