Ignore:
Timestamp:
03/11/14 22:45:58 (11 years ago)
Author:
hendrikvanantwerpen
Message:
  • Added subcodes to schema and config widgets.
  • Disallow empty strings in schema and strip objects before sending them to the server.
  • Finally managed proper change events in lists and complexvalues.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Dev/trunk/src/client/qed-client/widgets/ListWidget.js

    r502 r506  
    2525        _restoreParams: null,
    2626        _onChangeActive: false,
     27        _onChangeHandle: null,
    2728        buildRendering: function() {
    2829            this.inherited(arguments);
     
    8687                }
    8788            }
    88             //this.own(on(nodeOrWidget,'change',lang.hitch(this,'_handleChange')));
    8989            var node = nodeOrWidget.domNode ? nodeOrWidget.domNode : nodeOrWidget;
    9090            if ( hint !== "avatar" && node.id !== id ) {
     
    190190        _handleChange: function(evt) {
    191191            if ( evt.target !== this.domNode ) {
    192                 if ( this._onChangeActive && !(this.readOnly || this.disabled) ) {
    193                     this.emit('change',this.get('value'));
    194                 }
     192                this._onChange();
    195193                if ( evt ) { event.stop(evt); }
    196194                return false;
    197             }
    198             return true;
    199         },
    200         _handleDrop: function() {
    201             if ( this._onChangeActive && !(this.readOnly || this.disabled) ) {
    202                 this.emit('change',this.get('value'));
     195            } else {
     196                return evt;
     197            }
     198        },
     199        _handleDrop: function(evt) {
     200            this._onChange();
     201        },
     202        _onChange: function(){
     203            if ( this._onChangeActive &&
     204                 !(this.readOnly || this.disabled) ) {
     205                if ( this._onChangeHandle ) {
     206                    this._onChangeHandle.cancel();
     207                }
     208                this._onChangeHandle = this.defer(function(){
     209                    this._onChangeHandle = null;
     210                    on.emit(this.domNode,'change',{
     211                        target: this.domNode,
     212                        value: this.get('value'),
     213                        bubbles: true,
     214                        cancellable: true
     215                    });
     216                });
    203217            }
    204218        }
Note: See TracChangeset for help on using the changeset viewer.