Ticket #6690: dijit.form.ComboBox_20080507.patch
| File dijit.form.ComboBox_20080507.patch, 2.8 kB (added by jaredj, 8 months ago) |
|---|
-
form/ComboBox.js
297 297 // if they are just previewing the options available. 298 298 this._autoCompleteText(zerothvalue); 299 299 } 300 dataObject._maxOptions = this._maxOptions; 300 301 this._popupWidget.createOptions( 301 302 results, 302 303 dataObject, … … 502 503 deep: true 503 504 }, 504 505 query: query, 506 onBegin: dojo.hitch(this, "_setMaxOptions"), 505 507 onComplete: dojo.hitch(this, "_openResultList"), 506 508 onError: function(errText){ 507 509 console.error('dijit.form.ComboBox: ' + errText); … … 523 525 }, query, this), this.searchDelay); 524 526 }, 525 527 528 _setMaxOptions: function(size, request){ 529 this._maxOptions = size; 530 }, 531 526 532 _getValueField:function(){ 527 533 return this.searchAttr; 528 534 }, … … 701 707 //this._dataObject=dataObject; 702 708 //this._dataObject.onComplete=dojo.hitch(comboBox, comboBox._openResultList); 703 709 // display "Previous . . ." button 710 var displayMore = false; 711 //Try to determine if we should show 'more'... 712 if(dataObject._maxOptions && dataObject._maxOptions != -1){ 713 if((dataObject.start + dataObject.count) < dataObject._maxOptions){ 714 displayMore = true; 715 }else if((dataObject.start + dataObject.length) > (dataObject._maxOptions - 1)){ 716 //Weird return from a datastore, where a start + count > maxOptions 717 //implies maxOptions isn't really valid and we have to go into faking it. 718 //And more or less assume more if count == results.length 719 if(dataObject.count == results.length){ 720 displayMore = true; 721 } 722 } 723 }else if(dataObject.count == results.length){ 724 //Don't know the size, so we do the best we can based off count alone. 725 //So, if we have an exact match to count, assume more. 726 displayMore = true; 727 } 728 704 729 this.previousButton.style.display = (dataObject.start == 0) ? "none" : ""; 705 730 dojo.attr(this.previousButton, "id", this.id + "_prev"); 706 731 // create options using _createOption function defined by parent … … 714 739 this.domNode.insertBefore(menuitem, this.nextButton); 715 740 }, this); 716 741 // display "Next . . ." button 717 this.nextButton.style.display = (dataObject.count == results.length)? "" : "none";718 dojo.attr(this.nextButton,"id", this.id + "_next") 742 this.nextButton.style.display = displayMore ? "" : "none"; 743 dojo.attr(this.nextButton,"id", this.id + "_next"); 719 744 }, 720 745 721 746 clearResultList: function(){ … … 1010 1035 1011 1036 var start = args.start || 0, 1012 1037 end = ("count" in args && args.count != Infinity) ? (start + args.count) : items.length ; 1038 args.onBegin(items.length, args); 1013 1039 args.onComplete(items.slice(start, end), args); 1014 1040 return args; // Object 1015 1041 // TODO: I don't need to return the length?