Hybrid View

    You found a bug! We've classified it as EXTGWT-2468 . We encourage you to continue the discussion and to find an acceptable workaround while we work on a permanent fix.
  1. #1
    Ext GWT Premium Member dardison's Avatar
    Join Date
    Apr 2008
    Location
    Buenos Aires, Argentina
    Posts
    173
    Vote Rating
    1
    dardison is on a distinguished road

      0  

    Default ComboBox doQuery method seems not working with Remote Loader

    ComboBox doQuery method seems not working with Remote Loader


    Hi,

    I found that the method doQuery(String query, boolean force) for the ComboBox in gxt 3.0 is not taking in count the query string when the ComboBox has a Loader and so the ComboBoxCell query mode is QueryMode.REMOTE.

    Reading the code I found this at the doQuery method of the ComboBoxCell :

    Code:
        if (force || query.length() >= minChars) {
          if (!useQueryCache || !query.equals(lastQuery)) {
            lastQuery = query;
            if (mode == QueryMode.LOCAL) {
                  .....
                  .....
            }else{
              expand(context, parent, updater, value);
              @SuppressWarnings("unchecked")
              PagingLoader<PagingLoadConfig, PagingLoadResult<?>> l = (PagingLoader<PagingLoadConfig, PagingLoadResult<?>>) loader;
              l.load(getParams(query));
            }
    And below that the method getParams(String query) of the same class:

    Code:
      protected PagingLoadConfig getParams(String query) {
        PagingLoadConfig config = null;
        if (loader.isReuseLoadConfig()) {
          config = (PagingLoadConfig) loader.getLastLoadConfig();
        } else {
          config = new PagingLoadConfigBean();
        }
        config.setLimit(pageSize);
        config.setOffset(0);
        // config.set("query", query);
        return config;
      }
    It seems the query string was not taking in count.

    waiting for your comments.
    Regards
    Daniel

  2. #2
    Sencha User
    Join Date
    Nov 2011
    Posts
    7
    Vote Rating
    0
    AdamSas is on a distinguished road

      0  

    Default


    Hi,

    I recently came across the same problem. Could you please explain how should we now handle remote loading of data in a combobox when the parameter "query" is not filled anymore? In my previous implementation with GXT2 I used the value under key "query" as a search string in my business method (it was a combobox with remote autocomplete).

    Best regards,
    Adam Sas

  3. #3
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Thanks for this - not sure how it got missed the first time around, though not being in the Bugs forum probably didn't help.

    In the http://www.sencha.com/examples/#Exam...vancedcombobox sample, this code is used as a workaround:
    Code:
          PagingLoader<ForumLoadConfig, ForumListLoadResult> loader = new PagingLoader<ForumLoadConfig, ForumListLoadResult>(
              proxy, reader);
          loader.useLoadConfig(TestAutoBeanFactory.instance.loadConfig().as());
          loader.addBeforeLoadHandler(new BeforeLoadHandler<ForumLoadConfig>() {
            @Override
            public void onBeforeLoad(BeforeLoadEvent<ForumLoadConfig> event) {
              String query = combo.getText();
              if (query != null && !query.equals("")) {
                event.getLoadConfig().setQuery(query);
              }
            }
          });
    I've moved this to the bug forum, and will update it with progress on the issue.

    EDIT: The reason it doesn't work as is is that the PagingLoadConfig data doesn't have a field for query, while the ForumLoadConfig as used in the sample above has a specific piece for it. While it may be possible to support a FilterPagingLoadConfig by default, I'm not certain that we aim to expect that use case.

    For now, I would advise a workaround like the one shown - this may end up being the correct resolution for this.

  4. #4
    Sencha User
    Join Date
    Apr 2009
    Posts
    11
    Vote Rating
    1
    matthewdfleming is on a distinguished road

      0  

    Default My solve with FilterPagingLoadConfigBean

    My solve with FilterPagingLoadConfigBean


    Here's a way to do it without using any objects from the sample package. I'm making a callback using a "User" object. The combobox is submitting the "lastName" filter.

    Code:
    UserProperties props = GWT.create(UserProperties.class);
    ListStore<User> userListStore = new ListStore<User>(props.id());
    RpcProxy<FilterPagingLoadConfig, PagingLoadResult<User>> proxy = new RpcProxy<FilterPagingLoadConfig, PagingLoadResult<User>>() {
        @Override
        public void load(FilterPagingLoadConfig loadConfig, final AsyncCallback<PagingLoadResult<User>> callback) {
            // call the actual service you have
            ApplicationService.Util.getInstance().getAllUsers(loadConfig, callback);
        }
    };
    final PagingLoader<FilterPagingLoadConfig, PagingLoadResult<User>> loader = new PagingLoader<FilterPagingLoadConfig, PagingLoadResult<User>>(
            proxy);
    loader.setRemoteSort(true);
    loader.addLoadHandler(new LoadResultListStoreBinding<FilterPagingLoadConfig, User, PagingLoadResult<User>>(userListStore));
    
    final ComboBox<User> userComboBox = new ComboBox<User>(userListStore, props.fullName());
    userComboBox.setName("lastName");
    userComboBox.setLoader(loader);
    userComboBox.setTypeAhead(true);
    userComboBox.setEmptyText("Change User...");
    userComboBox.setPageSize(20);
    userComboBox.setMinChars(3);
    
    loader.addBeforeLoadHandler(new BeforeLoadEvent.BeforeLoadHandler<FilterPagingLoadConfig>() {
        @Override
        public void onBeforeLoad(BeforeLoadEvent<FilterPagingLoadConfig> event) {
            String query = userComboBox.getText();
            event.getLoadConfig().getFilters().clear();
            if (query != null && !query.equals("")) {
                FilterConfig filterConfig = new FilterConfigBean();
                filterConfig.setField(userComboBox.getName());
                filterConfig.setValue(query);
                event.getLoadConfig().getFilters().add(filterConfig);
            }
        }
    });
    loader.useLoadConfig(new FilterPagingLoadConfigBean());
    Here's the UserProperties interface..
    Code:
    interface UserProperties extends PropertyAccess<User> {
        ModelKeyProvider<User> id();
    
    
        LabelProvider<User> fullName();
    }

  5. #5
    Sencha - GXT Dev Team
    Join Date
    Feb 2009
    Location
    Minnesota
    Posts
    2,731
    Vote Rating
    90
    Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light Colin Alworth is a glorious beacon of light

      0  

    Default


    Thanks for the more complete workaround - of course, it'll always need to have its generics modified to match the current example being used, and if your server isn't expecting a full list of filter configs just to populate a ComboBox, you'll need something more specific like in the Advanced ComboBox example.

Turkiyenin en sevilen filmlerinin yer aldigi xnxx internet sitemiz olan ve porn sex tarzi bir site olan mobil porno izle sitemiz gercekten dillere destan bir durumda herkesin sevdigi bir site olarak tarihe gececege benziyor. Sitenin en belirgin ozelliklerinden birisi de Turkiyede gercekten kaliteli ve muntazam, duzenli porno izle siteleri olmamasidir. Bu yuzden iste. Ayrica en net goruntu kalitesine sahip adresinde yayinlanmaktadir. Mesela diğer sitelerimizden bahsedecek olursak, en iyi hd porno video arşivine sahip bir siteyiz. "The Best anal porn videos and slut anus, big asses movies set..." hd porno faketaxi