From 2f01fe57a8d37767827d6db42850aef86a767c53 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 15 Nov 2010 10:39:52 +0300 Subject: add dijit/dojo stuff; initial ui mockup --- lib/dijit/form/_FormSelectWidget.js | 307 ++++++++++++++++++++++++++++++++++++ 1 file changed, 307 insertions(+) create mode 100644 lib/dijit/form/_FormSelectWidget.js (limited to 'lib/dijit/form/_FormSelectWidget.js') diff --git a/lib/dijit/form/_FormSelectWidget.js b/lib/dijit/form/_FormSelectWidget.js new file mode 100644 index 000000000..5905c0aef --- /dev/null +++ b/lib/dijit/form/_FormSelectWidget.js @@ -0,0 +1,307 @@ +/* + Copyright (c) 2004-2010, The Dojo Foundation All Rights Reserved. + Available via Academic Free License >= 2.1 OR the modified BSD license. + see: http://dojotoolkit.org/license for details +*/ + + +if(!dojo._hasResource["dijit.form._FormSelectWidget"]){ +dojo._hasResource["dijit.form._FormSelectWidget"]=true; +dojo.provide("dijit.form._FormSelectWidget"); +dojo.require("dijit.form._FormWidget"); +dojo.require("dojo.data.util.sorter"); +dojo.declare("dijit.form._FormSelectWidget",dijit.form._FormValueWidget,{multiple:false,options:null,store:null,query:null,queryOptions:null,onFetch:null,sortByLabel:true,loadChildrenOnOpen:false,getOptions:function(_1){ +var _2=_1,_3=this.options||[],l=_3.length; +if(_2===undefined){ +return _3; +} +if(dojo.isArray(_2)){ +return dojo.map(_2,"return this.getOptions(item);",this); +} +if(dojo.isObject(_1)){ +if(!dojo.some(this.options,function(o,_4){ +if(o===_2||(o.value&&o.value===_2.value)){ +_2=_4; +return true; +} +return false; +})){ +_2=-1; +} +} +if(typeof _2=="string"){ +for(var i=0;i=0&&_2",this.srcNodeRef).map(function(_29){ +if(_29.getAttribute("type")==="separator"){ +return {value:"",label:"",selected:false,disabled:false}; +} +return {value:_29.getAttribute("value"),label:String(_29.innerHTML),selected:_29.getAttribute("selected")||false,disabled:_29.getAttribute("disabled")||false}; +},this):[]; +} +if(!this.value){ +this.value=this._getValueFromOpts(); +}else{ +if(this.multiple&&typeof this.value=="string"){ +this.value=this.value.split(","); +} +} +},postCreate:function(){ +dojo.setSelectable(this.focusNode,false); +this.inherited(arguments); +this.connect(this,"onChange","_updateSelection"); +this.connect(this,"startup","_loadChildren"); +this._setValueAttr(this.value,null); +},startup:function(){ +this.inherited(arguments); +var _2a=this.store,_2b={}; +dojo.forEach(["query","queryOptions","onFetch"],function(i){ +if(this[i]){ +_2b[i]=this[i]; +} +delete this[i]; +},this); +if(_2a&&_2a.getFeatures()["dojo.data.api.Identity"]){ +this.store=null; +this.setStore(_2a,this._oValue,_2b); +} +},destroy:function(){ +dojo.forEach(this._notifyConnections||[],dojo.disconnect); +this.inherited(arguments); +},_addOptionItem:function(_2c){ +},_removeOptionItem:function(_2d){ +},_setDisplay:function(_2e){ +},_getChildren:function(){ +return []; +},_getSelectedOptionsAttr:function(){ +return this.getOptions(this.get("value")); +},_pseudoLoadChildren:function(_2f){ +},onSetStore:function(){ +}}); +} -- cgit v1.2.3