Changeset 1376
- Timestamp:
- 20/11/09 14:53:16 (3 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/modules/kauri-forms/kauri-forms-extra/src/main/kauri/static/autocomplete/js/autocomplete.js
r1375 r1376 43 43 44 44 AutocompleteControl.prototype.initElements = function(create) { 45 $acinput = kf.ControlElements.lookup(this, "acinput", true);45 this.$acinput = kf.ControlElements.lookup(this, "acinput", true); 46 46 47 47 var me = this; … … 67 67 } 68 68 69 $acinput.autocomplete(this.dataUri, jqOptions).bind("result", function(event, objData, valueData) {69 this.$acinput.autocomplete(this.dataUri, jqOptions).bind("result", function(event, objData, valueData) { 70 70 me.setValue(objData); 71 71 }); … … 88 88 AutocompleteControl.prototype.setValue = function(value) { 89 89 this["<super.call>"]("setValue", [value]); 90 if (value === undefined) {91 $acinput.val();92 } else {93 //$acinput.val(this.inputTemplate.expand(value, true));94 }95 90 } 96 91 97 92 AutocompleteControl.prototype.getWireValue = function() { 98 var t = this.getValue();99 var s = JSON.stringify(t);100 93 return JSON.stringify(this.getValue()); 101 94 } … … 104 97 if (wireValue === undefined) { 105 98 this.setValue(undefined); 106 $acinput.val('');99 this.$acinput.val(''); 107 100 } else { 108 101 this.setValue(JSON.parse(wireValue)); 109 $acinput.val(this.inputTemplate.expand(this.getValue(), true));102 this.$acinput.val(this.inputTemplate.expand(this.getValue(), true)); 110 103 } 111 104 } trunk/samples/kauri-forms-sample/src/main/kauri/pages/autocomplete-control.html.xml
r1375 r1376 3 3 t:inherit="module:/templates/layout/layout.xml"> 4 4 5 <t:block name="title"> Selectioncontrol sample</t:block>5 <t:block name="title">Autocomplete control sample</t:block> 6 6 7 7 <t:block name="extra-headers"> … … 16 16 "base": "string", 17 17 "label": "Select a contact", 18 "control": { 19 "base": "autocomplete-control", 20 "dataUri": "${publicUri('service:/data/contact/')}", 21 "inputTemplate": "input:{id} - {name}", 22 "listTemplate": "list:{id} - {name} {email}" 23 } 24 }, 25 "another": { 26 "base": "string", 27 "label": "Select another contact", 18 28 "control": { 19 29 "base": "autocomplete-control", … … 43 53 </dl> 44 54 55 <dl kauri-idref="another"> 56 <dt><label kauri-role="label"/></dt> 57 <dd><input type="text" kauri-role="acinput"/></dd> 58 </dl> 59 45 60 </fieldset> 46 61 </form>
