Changeset 13726

Show
Ignore:
Timestamp:
05/13/08 10:11:14 (2 months ago)
Author:
bill
Message:

Fix detection of whether there's more data to fetch or not. Fixes #6690.
Patch from Jared (IBM, CCLA).

!strict

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • dijit/trunk/form/ComboBox.js

    r13615 r13726  
    320320                                this._autoCompleteText(zerothvalue); 
    321321                        } 
     322                        dataObject._maxOptions = this._maxOptions; 
    322323                        this._popupWidget.createOptions( 
    323324                                results,  
     
    526527                                        }, 
    527528                                        query: query, 
     529                                        onBegin: dojo.hitch(this, "_setMaxOptions"), 
    528530                                        onComplete: dojo.hitch(this, "_openResultList"),  
    529531                                        onError: function(errText){ 
     
    545547                                this._nextSearch = this._popupWidget.onPage = dojo.hitch(this, nextSearch, dataObject); 
    546548                        }, query, this), this.searchDelay); 
     549                }, 
     550 
     551                _setMaxOptions: function(size, request){ 
     552                         this._maxOptions = size; 
    547553                }, 
    548554 
     
    768774                        }, this); 
    769775                        // display "Next . . ." button 
    770                         this.nextButton.style.display = (dataObject.count == results.length) ? "" : "none"; 
    771                         dojo.attr(this.nextButton,"id", this.id + "_next") 
     776                        var displayMore = false; 
     777                        //Try to determine if we should show 'more'... 
     778                        if(dataObject._maxOptions && dataObject._maxOptions != -1){ 
     779                                if((dataObject.start + dataObject.count) < dataObject._maxOptions){ 
     780                                        displayMore = true; 
     781                                }else if((dataObject.start + dataObject.length) > (dataObject._maxOptions - 1)){ 
     782                                        //Weird return from a datastore, where a start + count > maxOptions 
     783                                        //implies maxOptions isn't really valid and we have to go into faking it. 
     784                                        //And more or less assume more if count == results.length 
     785                                        if(dataObject.count == results.length){ 
     786                                                displayMore = true; 
     787                                        } 
     788                                } 
     789                        }else if(dataObject.count == results.length){ 
     790                                //Don't know the size, so we do the best we can based off count alone. 
     791                                //So, if we have an exact match to count, assume more. 
     792                                displayMore = true; 
     793                        } 
     794 
     795                        this.nextButton.style.display = displayMore ? "" : "none"; 
     796                        dojo.attr(this.nextButton,"id", this.id + "_next"); 
    772797                }, 
    773798