Changeset 490 for Dev/trunk/src/client/qed-client/widgets
- Timestamp:
- 03/08/14 22:51:23 (11 years ago)
- Location:
- Dev/trunk/src/client/qed-client/widgets
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
Dev/trunk/src/client/qed-client/widgets/LineWithActionsWidget.js
r472 r490 44 44 onClick: lang.hitch(this, function(action, e){ 45 45 if ( action.callback ) { action.callback(e); } 46 event.stop(e);46 if ( e ) { event.stop(e); } 47 47 return false; 48 48 }, this.actions[action]) … … 58 58 onClick: lang.hitch(this, function(action, e){ 59 59 if ( action.callback ) { action.callback(e); } 60 event.stop(e);60 if ( e ) { event.stop(e); } 61 61 return false; 62 62 }, this.actions[action]) … … 73 73 var preventDefault = this.onClick(e) === false; 74 74 if (preventDefault) { 75 event.stop(e);75 if ( e ) { event.stop(e); } 76 76 } 77 77 return !preventDefault; -
Dev/trunk/src/client/qed-client/widgets/ListWidget.js
r443 r490 8 8 "dojo/dnd/Source", 9 9 "dojo/dnd/common", 10 "dojo/dom-construct" 11 ], function(_Container, _WidgetBase, registry, array, declare, lang, Source, dnd, domConstruct) { 10 "dojo/dom-construct", 11 "dojo/on" 12 ], function(_Container, _WidgetBase, registry, array, declare, lang, Source, dnd, domConstruct, on) { 12 13 return declare([_WidgetBase,_Container],{ 13 14 name: "", … … 49 50 }); 50 51 this.source = new this.container(this.domNode,sourceParams); 52 this.source.on('Drop',lang.hitch(this,'_handleChange')); 51 53 }, 52 54 creator: function(item, hint) { … … 66 68 } 67 69 } 70 on(nodeOrWidget,'change',lang.hitch(this,'_handleChange')); 68 71 var node = nodeOrWidget.domNode ? nodeOrWidget.domNode : nodeOrWidget; 69 72 if ( hint !== "avatar" && node.id !== id ) { … … 79 82 createListElement: null, /* function(id,item){},*/ 80 83 _getValueAttr: function() { 81 returnarray.map(this.source.getAllNodes(),function(node){84 this.value = array.map(this.source.getAllNodes(),function(node){ 82 85 var widget = registry.byNode(node); 83 86 if ( widget && "value" in widget ) { … … 87 90 } 88 91 },this); 92 return this.value; 89 93 }, 90 94 _setValueAttr: function(value) { … … 110 114 } 111 115 }, 112 appendItems: function(items ) {116 appendItems: function(items,forceEvent) { 113 117 this.source.insertNodes(false,items); 118 if ( forceEvent ) { this._handleChange(); } 114 119 }, 115 appendItem: function(item ) {120 appendItem: function(item,forceEvent) { 116 121 this.source.insertNodes(false,[item]); 122 if ( forceEvent ) { this._handleChange(); } 117 123 }, 118 removeItem: function(key ) {124 removeItem: function(key,forceEvent) { 119 125 array.forEach(array.filter(this.source.getAllNodes(), function(node){ 120 126 return node.id === key; 121 127 }), lang.hitch(this, "_destroyNodeOrWidget")); 122 128 this.source.delItem(key); 129 if ( forceEvent ) { this._handleChange(); } 123 130 }, 124 131 getChildren: function() { … … 127 134 }),function(widget){ return widget !== null; }); 128 135 }, 129 clear: function( ) {136 clear: function(forceEvent) { 130 137 array.forEach(this.source.getAllNodes(), 131 138 lang.hitch(this, "_destroyNodeOrWidget")); 132 139 this.source.clearItems(); 140 if ( forceEvent ) { this._handleChange(); } 133 141 }, 134 142 _destroyNodeOrWidget: function(node) { … … 149 157 this.source.destroy(); 150 158 this.inherited(arguments); 151 } 159 }, 160 _handleChange: function() { 161 this.value = this._getValueAttr(); 162 this.onChange(this.value); 163 }, 164 onChange: function(value) {} 152 165 }); 153 166 });
Note: See TracChangeset
for help on using the changeset viewer.