Announcement

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

    ComboBoxItem, OptionDataSource and cache

    Dear,

    I'm using a ComboBoxItem, connected to a RestDataSource.
    1. If I type some text, then my remote servlet is invoked, and the result is correctly filtered : ok
    2. If I close the combo and try again : ok
    3. If I click the down arrow (to display the full content of the list), my remote servlet is invoked, and the result is correctly displayed : ok
    4. Now, if i try to type some texte into the combo (after step 3), nothing happens, no result and no invocation of my remote servlet : ko
    5. If I try to click the down arrow, the result is correctly displayed but my remote servlet is not invoked : ko

    My main problem is step 4 (the step 5 is not really a problem), it means that if I click once it get all the combo content, then typing into the combo do not work anymore :( (looks like working with a cache, but there is something i don't understand).

    Below, some parameters of my combo:
    Code:
    localisationSection = new ComboBoxItem( "localisationSection" );
    
    localisationSection.setWidth( "*" );
    localisationSection.setCompleteOnTab( true );
    localisationSection.setColSpan( 2 );
    localisationSection.setTextMatchStyle( TextMatchStyle.SUBSTRING );
    
    final DataSource dataSource = new DataSource();
    dataSource.setDataURL( "localisationSection.rpc" );
    dataSource.setID( "localisationSection" );
    
    localisationSection.setValueField( "id" );
    localisationSection.setOptionDataSource( dataSource );
    localisationSection.setDisplayField( "displayField" );
    localisationSection.setAutoFetchData( false );
    localisationSection.setFilterLocally( false );
    Plateform is :
    Mac OSX 10.5
    Trunk version of smartgwt
    GWT 1.6.4
    It does the samething with hosted mode, firefox, IE or safari

    Please help...

    With my best regards.

    Alexandre

    #2
    In step 4, when you say "nothing happens", do you mean the ComboBox list of drop-down items does not even appear? If so, can you show a test case for this (or can you get it to happen in a sample?).

    Comment


      #3
      Dear,

      Sorry for the missing information.

      In the Step 4, the list is correctly displayed (content ok), but no communication with the server is done (as seen in the log). And after that, typing in the combo to get the autocomplete feature, it do not works anymore.

      With my best regards

      Alexandre

      Comment


        #4
        It's expected (and highly desirable) that no server contact occurs after the list of completions has been reduced to a small enough number that all possibilities have been loaded client-side. However auto-completion should continue normally.

        If it's not, please show the data in the pickList at that point and the search string you are typing where you are expecting more entries to disappear and aren't seeing that happen. Or again, best thing is to demonstrate the problem with one of the samples or a minimal, standalone test case.

        Comment


          #5
          Originally posted by Isomorphic
          It's expected (and highly desirable) that no server contact occurs after the list of completions has been reduced to a small enough number that all possibilities have been loaded client-side. However auto-completion should continue normally.
          In some cases, the possibilities are dynamic from a database. How can I enforce the ComboBoxItem to fetch the latest options from a database? Is it appropriate to add a ValueChangeHandler to fetch options? Like this
          Code:
          final ComboBoxItem comboBox = new ComboBoxItem();
          // set properties here
          .....
          comboBox.addChangeHandler(new ChangeHandler() {
          
          			public void onChange(ChangeEvent event) {
          				comboBox.fetchData();
          
          			}
          
          		});

          Comment


            #6
            No, if the options are continuously changing, then relying on change() isn't frequent enough (the user may open the picklist without changing the value) or to frequent (you don't want to fire many request while typing).

            Instead, use an override of getPickListFilterCriteria() to return an additional criterion which changes however frequently you think you need to re-fetch the data. When criteria differ, the client cache is ignored.

            Comment

            Working...
            X