Announcement

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

    #16
    Thank you very much!
    Regards

    Comment


      #17
      We've fixed the issue you encountered with the combined criteria ending up mis-formed.
      This fix will be present in the next nightly build dated May 5 or above.
      In the meantime you could also use setPickListFilterCriteriaFunction() to dynamically create your own criteria object when the pickList is shown

      Comment


        #18
        Thank you, will verify when the build becomes available.

        Comment


          #19
          Hi Isomorphic,

          The fix looks good; thank you.

          However, I am still trying to determine the best way to change that criteria from iContains to iStartsWith.

          Code:
                          criteria:[
                              {
                                  fieldName:"name",
                                  operator:"iContains",
                                  value:"A"
                              }
                          ]
          The text match style of the request is startsWith.

          Code:
             textMatchStyle:"startsWith",
          I tried a number of options on the pick list properties and the combo box item, but no luck.

          For example:

          Code:
          com.smartgwt.client.widgets.form.fields.FormItem.setOperator(OperatorId)
          
          // Passing DSRequest properties into the following...
          DSRequest optionFilterContext = new DSRequest();
          optionFilterContext.setTextMatchStyle(TextMatchStyle.STARTS_WITH);
          com.smartgwt.client.widgets.form.fields.ComboBoxItem.setOptionFilterContext(DSRequest)
          com.smartgwt.client.widgets.form.fields.ComboBoxItem.setPickListCriteria(DSRequest)
          Any suggestions would be appreciated.

          Thanks

          Comment


            #20
            This is supposed to be automatically derived from the textMatchStyle specified on the item itself (see comboBoxItem.setTextMatchStyle()) - but we see that isn't behaving as it should in this particular case.
            We see the problem and are getting a fix checked in today (should be present in the next nightly build, dated May 7 or above).
            If you need a workaround in the meantime, you can use setPickListFilterCriteriaFunction() to build your own custom criteria by hand.

            Regards
            Isomorphic Software

            Comment


              #21
              Thanks; I can wait for the changes.

              I did experiment a bit with setPickListFilterCriteriaFunction(), however, I couldn't seem to capture the currently typed value.

              I had something like the following, but the item.getValueAsString() was null when I typed in the combo box. I suspect the value isn't in the item yet, but didn't see it available from the itemContext either. Any guidance here as to how I should be capturing the currently typed-in value?

              Code:
                          final String foreignDisplayField = "name";
                          item.setPickListFilterCriteriaFunction(new FormItemCriteriaFunction() {
              
                              @Override
                              public Criteria getCriteria(FormItemFunctionContext itemContext) {
                                  FormItem i = itemContext.getFormItem();
                                  if (!(i instanceof ComboBoxItem)) return null;
                                  ComboBoxItem item = (ComboBoxItem) i;
                                  AdvancedCriteria c1 = new AdvancedCriteria(<some static criteria>);
                                  boolean filterWithValue = item.getFilterWithValue();
                                  if (filterWithValue) {
                                      AdvancedCriteria c2 = new AdvancedCriteria(foreignDisplayField, OperatorId.ISTARTS_WITH, item.getValueAsString());
                                      return DataSource.combineCriteria(c1, c2, CriteriaCombineOperator.AND);
                                  }
                                  return c1;
                              }
                          });
              Additionally, the setPickListFilterCriteriaFunction() approach doesn't appear to be supported by the SelectItem? Is that correct?

              Thanks

              Comment


                #22
                The getEnteredValue() method is appropriate to pick up the value currently in the text-box (which may not yet have been persisted to be the "current value" of the item)

                Comment


                  #23
                  Ah, thank you!

                  Comment

                  Working...
                  X