Announcement

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

    setPickListCriteria causes only one call to the server

    I'm using SmartGWT 2.4 and with latest GWT.

    When I create a combobox with setPickListCriteria, it only submits one request to the server (either after opening the picklist of after typing something into the box), then no more - the picklist stays the same forever, whatever I type.

    If I don't set setPickListCriteria, calls are made to the server with anything I type, repeatedly, the way they should be.

    Is there a reason for this behavior? The criteria I'm setting (for example) is a Criterion saything that "available" equals "true" - so that you can try the same use case.

    Thank you for your reply.

    #2
    Concrete example:

    This works fine:
    Code:
    public class EMFEntityComboBoxItem extends ComboBoxItem {
    
    	public EMFEntityComboBoxItem() {
    		setOptionDataSource(ds); // Any data source
    		setFetchDelay(400);
    		setValueField("e_id");
    		setDisplayField("e_label");
    	}
    
    }
    This causes only one call to the server to be made:
    Code:
    public class EMFCriteriaComboBoxItem extends ComboBoxItem {
    
    	public EMFComboBoxItem() {
    		setOptionDataSource(ds); // Use same data source as in first example
    		setFetchDelay(400);
    		setValueField("e_id");
    		setDisplayField("e_label");
    		setPickListCriteria(new Criterion("available", OperatorId.EQUALS, "true"));
    	}
    
    }

    Comment


      #3
      I'm also experiencing this problem.

      I tried using setOptionCriteria() instead of setPickListCriteria(). Same problem.

      Comment


        #4
        The PickList caches data in exactly the manner described in the docs for ResultSet. What you're really seeing is that the criteria reduce the number of matching entries so that all matching results are retrieved in the first fetch, resulting in all client-side filtering after the first results are fetched.

        Comment


          #5
          Hi,
          did you find any solution?

          We are facing the same problem.

          Example 1
          1. Open the combobox without typing any text
          2. Combobox fetches the data from the server
          3. (optional) if it is paged - lot of results - scroll a little. It is fetching data properly
          4. Type something into the combobox
          5. Filter doesn't apply. Criteria is built, it is different, but server is not called

          Example 2
          1. Type something into the combobox.
          2. Server is properly called
          3. Type something else
          4. Combobox holds the result from the previous call and no new call is performed

          Our test code is 99% similar to the one which is described here (some static critera + hashbuster) and the behavior is exactly the same. Maybe it is really something wrong with the combobox.

          This is real pain. Hope there will be a solution available soon.

          Thank you.

          Comment


            #6
            See previous response. It is expected behavior that there is no second server call. If the results are wrong, explain what's wrong with them and what you expected.

            Comment


              #7
              If I understand the docs correctly, it says that in order to make the pickList fetch data from server every time its input changes, I need to set a custom ResultSet on the DataSource. This ResultSet should have 'useClientFiltering' flag false and possibly 'dropCacheOnUpdate' true.

              Unfortunately the docs are not very clear about the ways to do that. Searching your website only returned the same question unanswered. What should I do with my ExtendedResultSet so I can use DataSource.setResultSetClass(String resultSetClass) ?

              Comment


                #8
                It says nothing like this and you do not need to extend ResultSet or directly use ResultSet at all. Probably best to delete everything you've written, and start over from a sample.

                Comment


                  #9
                  Hello Isomorphic,

                  I'm afraid we are getting a bit off course here. I understand what you're saying. I've been working in SmartGWT for a few years now, and I'm aware that the picklist caches its data, nothing wrong with that. But that's really not the problem here.

                  Please ignore anything I've said until now, and answer this very simple question, so that we can move on from there:
                  When the criteria for the picklist of a combobox changes, should a new call to the server be made, or not?

                  I'm prepared to create a simple standalone SmartGWT application to demonstrate, if required.

                  Thank you in advance,
                  plech.d

                  Comment


                    #10
                    Wow, you've been using SmartGWT longer than we have then!

                    Once again, read the ResultSet docs. Whether or not there is a server call depends on whether local filtering can be performed based on the changed criteria.

                    Comment


                      #11
                      The ResultSet doc says
                      The 'useClientSorting' and 'useClientFiltering' flags can be used to disable client-side sorting and filtering respectively if these behaviors don't match server-based sorting and filtering. However, because client-side sorting and filtering radically improve responsiveness and reduce server load, it is better to customize the ResultSet so that it can match server-side sorting and filtering behaviors.
                      If this does not apply to pickLists, how can we disable client side filtering on them?

                      Comment


                        #12
                        Hello,
                        I have the same problem,
                        Have you found a solution ?

                        Comment


                          #13
                          As covered above, the ResultSet property useClientFiltering can be set on the pickList via pickListProperties > dataProperties.

                          In more recent versions, useClientFiltering can be set directly on the comboBox, as a shortcut.

                          Comment

                          Working...
                          X