Announcement

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

    New filter components

    I am trying to show the new filter components in a listGrid but it is just not showing, although everything should be set. I only see the "old" filter.

    http://www.smartclient.com/smartgwt/...er_live_filter (this is what I am trying to do with my grid).

    While I am isolating my problem, it may be helpful if you have some idea why the new filter components may not be appearing.

    I will continue to isolate the problem but as I said maybe you have an idea.

    Using 6.0p 08.04.16 power

    #2
    You've linked to a sample that is not a feature, but we're guessing you might mean the new allowFilterOperators feature.

    When the feature is enabled, if there are no AdvancedCriteria applied that use operators other than the default of "iContains", there initially will not be a visual change to the grid. You can tell the feature is active because the header contextMenu has a "Filter by.." submenu.

    Comment


      #3
      Yes, this is what I was trying to do. But not even the context menu "filter by..." was shown!!

      The problem was that the listGrid had .setAllowFilterExpressions(true) set. But is this correct ?? The docs say:
      Code:
      "Causes a menu item titled "Filter using" to appear in the headerContextMenu that allows the end user to pick an advanced search operator to use for this field."
      But this is not the case when.setAllowFilterEpressions(true) : so either this is a bug or the docs are not accurate.

      I have some other problems:
      1) The german translation for "is null" is COMPLETELY incorrect. It says "ist nicht leer", which is completely opposite, since "ist nicht leer" translates to "is not empty".
      You translated "is not null" to "ist nicht NULL", which is correct. So "is null" should be translated to "ist NULL", according to this.
      Please note that this is not a customization wish -> The translation is COMPLETELY WRONG.

      2) how to reset the filter operators?
      I am changing the criteria of a grid and it is still showing the filter operator chosen by the user previously. But this does not make sence in the new context. How to reset the filter editor completely, including the filter operators ?
      Last edited by edulid; 8 Apr 2016, 11:26.

      Comment


        #4
        1) that's a user-contributed translation. If it's wrong, you can correct the translation on getLocalization.com (see sticky thread)

        2) we can't figure out what you're saying here, please try again and be more specific about the operations being performed and APIs being called

        Comment


          #5
          1) What do you mean with sticky thread?
          2) Testcase:

          Steps:
          a) Filter capital on "is not null"
          b) Click button, which filters countries starting with "A"
          c) The capital is still filtered on "is not null". How to remove this and to set the selected filter to the default, i.e. to "contains (standard)" ? And to redraw the filter component so that it shows the "contains (standard)" filter ?

          Code:
          public void onModuleLoad() {
          
                  VLayout vlayout = new VLayout();
          
                  final ListGrid countryGrid = new ListGrid() {
                      @Override
                      protected Canvas getExpansionComponent(final ListGridRecord record) {
                          HLayout hlayout = new HLayout();
                          LayoutSpacer space = new LayoutSpacer();
                          space.setHeight(100);
                          hlayout.addMember(space);
          
                          VLayout layout = new VLayout(5);
                          layout.setPadding(10);
          
                          hlayout.addMember(layout);
                          return hlayout;
                      }
                  };
                  countryGrid.setWidth(500);
                  countryGrid.setHeight(300);
          
                   countryGrid.setDataSource(WorldXmlDS.getInstance());
                  
                   ListGridField nameField = new ListGridField("countryCode", "countryCode",
                   50);
                   ListGridField vornameField = new ListGridField("countryName",
                   "country");
                   ListGridField gebDatumField = new ListGridField("capital", "capital");
          
                  countryGrid.setFields(nameField, vornameField, gebDatumField);
          
                  countryGrid.setAutoFetchData(false);
          
                  DSRequest prop = new DSRequest(DSOperationType.FETCH);
                  prop.setOutputs("f_name,f_vorname,f_geb_datum,f_schueler_id");
          
                  countryGrid.setShowAllRecords(false);
          
                  countryGrid.setShowFilterEditor(true);
                  countryGrid.setCanEdit(false);
                  countryGrid.setFilterOnKeypress(false);
                  countryGrid.setCanExpandRecords(true);
                  countryGrid.setCanExpandMultipleRecords(false);
                  countryGrid.setWrapCells(true);
                  countryGrid.setFixedRecordHeights(false);
          
                  countryGrid.setCanDragRecordsOut(true);
                  countryGrid.setDragDataAction(DragDataAction.COPY);
                  countryGrid.setDragTrackerMode(DragTrackerMode.TITLE);
          
                  countryGrid.setShowRowNumbers(true);
          
                  countryGrid.setEmptyMessage("no data");
                  countryGrid.setCanHover(true);
          
                  countryGrid.fetchData(null, null, prop);
          
                  vlayout.addMember(countryGrid);
          
                  IButton but = new IButton("filter");
                  but.addClickHandler(new ClickHandler() {
          
                      @Override
                      public void onClick(ClickEvent event) {
                          AdvancedCriteria ac = new AdvancedCriteria(OperatorId.AND,
                                  new Criterion[] { new Criterion("countryName", OperatorId.STARTS_WITH, "A") });
                          countryGrid.fetchData(ac);
                      }
                  });
          
                  vlayout.addMember(but);
          
                  vlayout.draw();
              }
          3) You didn't answer my question above (with setAllowFilterEpressions(true)) : are the docs incorrect or is this a bug?

          Comment


            #6
            Edit 2)
            Actually the code doesn't reflect my problem. In the code I posted the filter does not dissapear, so the listGrid continues to filter to "isNull". If I check the RPC Requests, I still see the isNull filter. This is correct.
            But in my code (which is more difficult to isolate), the filter is gone (nothing to see in the RPC requests), but the field component does not completely reset. i.e. the selected filter (with the check mark) in the GUI is "is not null", but nothing is in the RPC request. I just need to reset the field to the default filter "contains(default"). Is there any way to reset the field filters ?

            Comment


              #7
              2) Testcase, which actually reflects the problem(bug?)

              Instructions:
              1) Right click on "capital", filter on "is null".
              2) Click on the smartgwt filter button to filter
              3) Click the button "set fields"
              ---> You cannot write anything on the "capital" filter (and the "is null" button is gone!!) . If you check the selected filter, the filter "is null" is still set. But there is no "is null" filter on the RPC request. So the correct behavior would be to select the default filter and leave the filter editable.

              Code:
              public void onModuleLoad() {
              
                      VLayout vlayout = new VLayout();
              
                      final ListGrid countryGrid = new ListGrid() {
                          @Override
                          protected Canvas getExpansionComponent(final ListGridRecord record) {
                              HLayout hlayout = new HLayout();
                              LayoutSpacer space = new LayoutSpacer();
                              space.setHeight(100);
                              hlayout.addMember(space);
              
                              VLayout layout = new VLayout(5);
                              layout.setPadding(10);
              
                              hlayout.addMember(layout);
                              return hlayout;
                          }
                      };
                      countryGrid.setWidth(500);
                      countryGrid.setHeight(300);
              
              
                       countryGrid.setDataSource(WorldXmlDS.getInstance());
                      
                       final ListGridField nameField = new ListGridField("countryCode", "countryCode",
                       50);
                       final ListGridField vornameField = new ListGridField("countryName",
                       "country");
                       final ListGridField gebDatumField = new ListGridField("capital", "capital");
              
                      countryGrid.setFields(nameField, vornameField, gebDatumField);
              
                      countryGrid.setAutoFetchData(false);
              
                      final DSRequest prop = new DSRequest(DSOperationType.FETCH);
                      prop.setOutputs("f_name,f_vorname,f_geb_datum,f_schueler_id");
              
                      countryGrid.setShowAllRecords(false);
              
                      countryGrid.setShowFilterEditor(true);
                      countryGrid.setCanEdit(false);
                      countryGrid.setFilterOnKeypress(false);
                      countryGrid.setCanExpandRecords(true);
                      countryGrid.setCanExpandMultipleRecords(false);
                      countryGrid.setWrapCells(true);
                      countryGrid.setFixedRecordHeights(false);
              
                      countryGrid.setCanHover(true);
              
                      countryGrid.fetchData(null, null, prop);
              
                      vlayout.addMember(countryGrid);
              
                      IButton but = new IButton("set fields");
                      but.addClickHandler(new ClickHandler() {
              
                          @Override
                          public void onClick(ClickEvent event) {
                              countryGrid.setFields(nameField, vornameField, gebDatumField);
                          }
                      });
              
                      vlayout.addMember(but);
              
                      vlayout.draw();
                  }

              Comment


                #8
                edulid I think this is the sticky thread Isomorphic is talking about: http://forums.smartclient.com/forum/...ework-messages

                Comment


                  #9
                  You're not allowed to reuse ListGridField instances like that - you have to pass fresh copies, as the fields may be modified by later actions and pick up state that is not valid for the setFields() call. Does the problem still occur if you correct this?

                  Comment


                    #10
                    In previous versions (5.1) I was using the listGrid in this exact way and everything was working well.
                    So it is not possible now to assign a new set of fields to the listGrid during runtime ?
                    How to achieve this then?

                    Comment


                      #11
                      And I am not "reusing" the listgrid, I am only setting a new list of fields to show in the listGrid. How to achieve this then ?

                      Comment


                        #12
                        Same way you achieved it the first time: new ListGridField()... setFields().

                        This has always been disallowed, but in different versions the bad usage might have less or more obvious side effects.

                        Comment


                          #13
                          Originally posted by edulid View Post


                          3) You didn't answer my question above (with setAllowFilterEpressions(true)) : are the docs incorrect or is this a bug?

                          Comment


                            #14
                            A bit of both. Right now, the two modes don't work together and we will be adding a note explaining this to the docs. However that note will be there only temporarily, because the intended design was that allowFilterExpressions syntax can be used an alternative way to add an operator to a field (instead of picking from a menu). But correcting that will take a while since we are having the usual post-release flood of issue reports.

                            Comment


                              #15
                              On 1) : While trying to register in getlocalization.com , I get a message that I need to contact the developer for getting an exact url for registering if wanting to contribute.

                              I just need to correct this one message, would it be possible that you please correct it or tell me exacly what to do to correct it?

                              Comment

                              Working...
                              X