Announcement

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

    ComboBox implementation problem

    Greetings,

    I'm having some issues with the combobox item. It wouldn't surprise me if it was my implementation. I've searched quite a bit on the forums and gone over the docs. I'm using the type-ahead/criteriafilter functionality.

    The box works fine, but it has two problems:
    1) If I backspace very quickly in the type-ahead field, it simply stops responding and won't work again until I reload the page. If I backspace slowly, no problem. This is very repeatable.
    2) When I get the selection pulldown as I type-ahead, if I arrow down into the list first, then use my mouse it works perfectly. However, if I don't use arrow keys, but rather move my mouse down over the selection list, all rows hilite as I move over them and they never un-hilite. Also, this behavior is intermittent. Sometimes it does it, sometimes it doesn't.

    I've been messing with it for two days to no avail. Can you provide some suggestions on what might be wrong with my implementation? This is version 7.0rc2, using IE 8.

    Code:
    isc.DynamicForm.create({
        fields:[
            {prompt:"Search for companies by entering a ticker symbol, full or partial company name, NAIC code, or group name.",
            	hint:"Enter ticker, name, NAIC code or group", 
                showHintInField:true, 
                name:"qsSearchField",
                showPickerIcon:false,
                showFocused:false,
                valueField:"company_name",
                selectOnFocus:false,
                textMatchStyle:"startsWith",
                pickListCriteria:{name: "qsSearchField"},
                optionDataSource: "GlobalQuickSearchDataSource", editorType: "comboBox",
                showTitle:false, width:350, pickListHeaderHeight:0,
                pickListFields: [
    							 {name: 'company_name', showTitle:false, width:270},
                                 {name: 'ticker', showTitle:false, width:60} 
                               ],            
               	getPickListFilterCriteria : function () {
                       var value = this.getDisplayValue();
                       return {value:value};
                }        		 
                },
               	{startRow:false, disabled:true, name:"findbtn", editorType:"button", width:100, title:"Find", 
                	click:"layoutViewController('quickSearch');quickSearch(quickSearchForm.getValue('qsSearchField'))"}            
        ],
        ID:"quickSearchForm",
        autoDraw:false
    })
    Attached Files

    #2
    On the second behavior, this can be due to either not providing totalRows in your DSResponse, or providing an incorrect value (including String instead of Integer type).

    That may also explain the first behavior. If it doesn't:

    Can you move to 8.0? If you can, you may as well do so, because if this is a bug, it's probably been corrected.

    Do you have any third-party JavaScript libraries in the page? Try removing them, as this sounds like it could be due to event interference.

    Why are you overriding getPickListFilterCriteria()? Your implementation is similar but not identical to the built-in behavior. If you remove your override, does it correct the problem?

    Finally, have you tried logging what criteria you are providing when rapid deletes occur - is the criteria actually stale or does the criteria appear correct and something downstream is the problem?

    Finally 2, have you checked whether there are in fact new, valid requests being fired, but perhaps something in your DataSource layer is returning the wrong data? The RPC tab would be good for this.

    Comment


      #3
      As I suspected, I over-complicated the implementation. So I've stripped it down to the bare essentials and added dsResponse.setTotalRows. This corrected the highlighting problem. I do still however have the backspace problem. When hitting backspace rapidly several times (or holding it down) it stops firing events on the keystrokes. Nothing goes to the fetchData servlet when the problem occurs, it simply stops responding.

      I'd be open to upgrading, but I don't think that's the problem because when I try your combobox example in the feature explorer, I can't make this problem happen. It works correctly every time. Any ideas?

      Here is how the combobox is implemented now:
      Code:
      isc.DynamicForm.create({
          fields:[
              { name:'company_name', optionDataSource: "GlobalQuickSearchDataSource", editorType: "comboBox", width:350 }
          ],
          ID:"quickSearchForm",
          autoDraw:false
      });
      And the servlet:
      Code:
          public DSResponse fetchData(HttpServletRequest request, DSRequest dsRequest, HttpServletResponse response) throws Exception{
              
          	log.info("Processing global quick search");
          	
          	String companyName = dsRequest.getCriteria().get("company_name").toString();
          	System.out.println("Company name: " + companyName);
      
          	_result = new NSGQSResult(companyName, request, response);
              _result.loadTypeAheadDataPoints();
      
              DSResponse dsResponse = new DSResponse(dsRequest == null ? (DataSource)null : dsRequest.getDataSource());
              dsResponse.setData(_result.getResultList());
              dsResponse.setTotalRows(_result.get_totalRows());
              
              return dsResponse;
          
          }

      Comment


        #4
        Are you aware that there's an intentional behavior here of not fetching when we've got all data, called Adaptive Filtering? This means it would be expected in some cases for client-side filtering to take place, and maybe the client-side filtering isn't matching what your server would do (eg substring vs startsWith match).

        See also ComboBoxItem.textMatchStyle and filterLocally.

        Comment


          #5
          Yes I'm aware of that functionality and have been using it. I stripped it out of what I posted here because I wanted to eliminate it as a possibility. The combobox works perfectly if I type ahead, or backspace at a normal speed. If I backspace all the way back to the beginning of the field, then start typing again, it works perfectly. It's only if I hold down the backspace key, or backspace many times quickly that it appears to clear itself out, stops showing any results and stops making requests to the server. I'll play with textMatchStyle and filterLocally more to see of that alters the problem.

          Comment


            #6
            I've spent the day tracing and trying different things. I looked in the isc logs, I've done analysis on the dsRequest and dsResponse objects. I've not come up with why it happens. I did find a work around, but it causes a different problem, which is curious. Perhaps this new result will provide a clue. The work around is in the code below. The result is, now when I backspace rapidly until the field is empty, it starts an infinite loop, where the combobox fires a dsRequest to the servlet constantly, over and over, until I hit a key again (starting a search) or reload the page. So this isn't much of a work around, but maybe it shines a light on what is happening.

            Code:
            isc.DynamicForm.create({
                fields:[
                    { name:'company_name', optionDataSource: "GlobalQuickSearchDataSource", editorType: "comboBox", width:350,
                       	getPickListFilterCriteria : function () {
            	           	 var value = this.getDisplayValue();
                	        if (value == '') {
            						value=' ';
                        	}
                        	return {value:value};
            		    }        		 
                     }
                ],
                ID:"quickSearchForm",
                autoDraw:false
            });

            Comment


              #7
              Okay this workaround now completely works. The looping was caused because I was accidentally doing a setTotalRows(1) when it should have been zero. So I'm all set now... although I'm lost as to why I needed the work around.

              Comment

              Working...
              X