Announcement

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

    After FilterBuilder initialization with default AdvancedCriteria numeric 0 value disappears

    Hi! Aim is to start FilterBuilder setting default AdvancedCriteria. To achieve it, I can extend the Showcase https://www.smartclient.com/smartgwt...r_builder_grid with a new function getDefaultCriteria(…) see code below. To call it inserted a new code line into existing GridNestedFilterBulderSample(). To achieve the aim I can do a) But I cannot set value 0 for numeric fields at first.

    a) Setting String defaultName = "countryName"; in getDefaultCriteria();
    a1) Country contains (empty) appears OK (our aim)
    a2) Selecting Population greater than 0 (numeric field!) then 0 disappears (?)
    a3) Another values are all in right, e.g. 1 gives 1.

    b) Setting String defaultName = "x"; in getDefaultCriteria(); This is an invalid field name, see the function below.
    b1) Code = (empty) appears (our aim unsatisfied)
    b2) Selecting Population greater than 0 (numeric field!) then 0 appears (!)

    How can I set the default starting AdvancedCriteria for FilterBuilder to achive 0 value for numeric fields?

    GridNestedFilterBulderSample()
    Code:
    [B]final[/B] FilterBuilder filterBuilder = [B]new[/B] FilterBuilder();
    filterBuilder.setDataSource(worldDS);
    [B]filterBuilder.setCriteria(getDefaultCriteria(filterBuilder));[/B]
    [B]final[/B] ListGrid countryGrid = [B]new[/B] ListGrid();
    countryGrid.setWidth(550);
    countryGrid.setHeight(224);
    countryGrid.setDataSource(worldDS);
    countryGrid.setAutoFetchData([B]true[/B]);
    Code:
    private AdvancedCriteria getDefaultCriteria(FilterBuilder filterBuilder) {
        String name = null;
        String defaultName = "countryName"; // "x"
        for (DataSourceField dsf : filterBuilder.getDataSource().getFields()) {
            if (dsf.getName().equals(defaultName)) {
                name = dsf.getName();
                break;
            }
        }
    
        if (name != null) {
            AdvancedCriteria initialCriteria = new AdvancedCriteria();
            initialCriteria.setOperator(OperatorId.AND);
            Criterion crit = new Criterion(name, OperatorId.ICONTAINS, "");
            initialCriteria.buildCriterionFromList(OperatorId.AND, new Criterion[] { crit });
            return initialCriteria;
        }
        return new AdvancedCriteria();
    }
    Reproduced:
    FF ESR 24.8.1
    GC Version 61.0.3163.100 (Offizieller Build) (64-Bit)
    IE 11 Version 11.713.10586.0, Update 11.0.38 (KB3203621)
    GWT Version : 2.6.0
    SmartGWT Version : 6.0p (Tue Feb 28 12:52:00 CET 2017)

    #2
    This looks like a long-ago fixed bug. Please try with the latest patched version and let us know if the problem is still there.

    Note also it generally makes sense to do this first rather than preparing a test case and posting.

    Comment


      #3
      Yes, the problem is still there. Please check my sample code.
      Reproduced:
      SmartGWT Version: 6.0p (Tue Oct 24 12:38:00 GMT+200 2017)

      Comment


        #4
        We're not able to reproduce the problem you mention using SGWT 6.0p from 2017-10-24.

        You've provided code that acheives (a), but how did you attempt (a2)? By augmenting getDefaultCriteria() or by interacting with the UI? If the latter, please attach a video capture of your interaction. If the former, please provide the code you're using.

        Comment


          #5
          Please run the extended sample code with getDefaultCriteria() mentioned in first post, then try to reproduce following steps as in video capture in UI. (The commented "x" is there to test the default initialization only)

          1) Select Population greater than 0. (OK)
          2) Press [Tab]. (ERROR) (0 disappears)
          3) Select Population greater than 1. (OK)
          4) Press [Tab]. (OK) (1 appears)

          Could you please check the code for the behavior of disappearing numeric 0 value?

          Reproduced:
          SmartGWT Version: 6.0p (Tue Oct 24 12:38:00 GMT+200 2017)

          Sorry, I could not upload the video capture (19s) neither avi (36M) nor zip (1M) nor rar (78K) because these formats did not accepted on your web site. Which is the accepted format? Click image for larger version

Name:	FilterBuilderNumeric0.png
Views:	79
Size:	5.3 KB
ID:	250070

          Comment


            #6
            Hi bnagwt,

            I'm using animated Gifs created with ScreenToGif for this.

            Best regards
            Blama

            Comment


              #7
              Hi Blama, thx for the tool tip :-)
              This is very simple scenario. Here 1 is OK, but 0 disappears, leaving the numeric field.
              Isomorphic, could you please reproduce and check this behavior?
              Click image for larger version

Name:	FilterBuilderNumeric0.gif
Views:	87
Size:	49.6 KB
ID:	250080

              Comment


                #8
                We see the issue you mention and are looking into a solution. As a temporary workaround, note that if you set the field to 1 first, then you can set it to 0 and it will stick.

                Comment


                  #9
                  This should be fixed in today's nightly builds (dated 2017-11-02) back to SGWT 5.1p/SC 10.1p.

                  Comment


                    #10
                    It is OK. Nightly Build SmartGWT Version: 6.0p (Sat Nov 11 12:44:00 GMT+100 2017) Browsers FF + GC + IE.
                    Thank you :-)

                    Comment

                    Working...
                    X