Opened 13 years ago

Closed 12 years ago

#1186 closed enhancement (fixed)

[patch][cla] widget: ComboBox, allow data to be passed directly(instead of by URL/option tags).

Reported by: csawyer@… Owned by: Douglas Hays
Priority: high Milestone: 0.9
Component: Widgets Version: 0.2
Keywords: combobox widget Cc:
Blocked By: Blocking:

Description

Below is an SVN diff from rev 4965, for allowing data to be passed directly, instead of requiring a dataUrl, or as options to a combobox widget.

You can see this in action(example HTML/JS code) at: http://www.yuma.ca/tech/js/testWidget.html

I didn't see any notes on the developer page of how to submit patches/enhancement requests. If this is not the right way please let me know.

Index: src/widget/ComboBox.js
===================================================================
--- src/widget/ComboBox.js	(revision 4965)
+++ src/widget/ComboBox.js	(working copy)
@@ -77,7 +77,11 @@
 	this.init = function(cbox, node){
 		if(!dojo.string.isBlank(cbox.dataUrl)){
 			this.getData(cbox.dataUrl);
-		}else{
+		}
+		else if(dojo.lang.isArray(cbox.data)){
+			this.setData(cbox.data);
+		}
+		else{
 			// check to see if we can populate the list from <option> elements
 			if((node)&&(node.nodeName.toLowerCase() == "select")){
 				// NOTE: we're not handling <optgroup> here yet
@@ -239,6 +243,7 @@
 		searchTimer: null,
 		searchDelay: 100,
 		dataUrl: "",
+		data: "",
 		fadeTime: 200,
 		// maxListLength limits list to X visible rows, scroll on rest 
 		maxListLength: 8, 

Change History (8)

comment:1 Changed 13 years ago by dylan

Summary: widget: ComboBox, allow data to be passed directly(instead of by URL/option tags).[patch] widget: ComboBox, allow data to be passed directly(instead of by URL/option tags).

need to verify that we have a cla on file, http://dojotoolkit.org/foundation/

comment:2 Changed 13 years ago by dylan

Summary: [patch] widget: ComboBox, allow data to be passed directly(instead of by URL/option tags).[patch][need cla] widget: ComboBox, allow data to be passed directly(instead of by URL/option tags).

No CLA on file, any chance we can get a CLA for this one? http://dojotoolkit.org/foundation/

comment:3 Changed 13 years ago by dylan

Milestone: 0.40.5

no CLA yet, bumping to 0.5

comment:4 Changed 13 years ago by csawyer@…

My employer Yuma Union High School District should have a CLA on file with you guys now.

comment:5 Changed 13 years ago by tk

Summary: [patch][need cla] widget: ComboBox, allow data to be passed directly(instead of by URL/option tags).[patch][cla] widget: ComboBox, allow data to be passed directly(instead of by URL/option tags).

Updated to show CLA on file. -> Yuma Union High School District #70

comment:6 Changed 13 years ago by Douglas Hays

Owner: changed from bill to Douglas Hays

comment:7 Changed 12 years ago by haysmark@…

You can use the data property to assign data directly. For example:

new dijit.form.AutoCompleter?({data:{items:[{name:"California"}]}, name:"prog",autocomplete:false,searchField:"name"}, document.getElementById("progCombo"));

comment:8 Changed 12 years ago by Douglas Hays

Resolution: fixed
Status: newclosed

(In [8352]) Port of ComboBox?(=AutoCompleter?) and Select widgets to 0.9 dojo by haysmark@…. Fixes #2189, #1504, #1451, #2244, #2384, #2070, #899, #912, #1267, #1339, #1456, #1484, #1485, #2558, #1186

Note: See TracTickets for help on using tickets.