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.
Location:
Dev/trunk/src/client/qed-client/widgets
Files:
2 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        }
  • Dev/trunk/src/client/qed-client/widgets/_ComplexValueMixin.js

    r500 r506  
    1515        readOnly: false,
    1616        _onChangeActive: false,
     17        _onChangeHandle: null,
    1718        constructor: function() {
    1819            this._listenerMap = {};
     
    9899        _handleChange: function(evt) {
    99100            if ( evt.target !== this.domNode ) {
    100                 if ( this._onChangeActive && !(this.readOnly || this.disabled) ) {
    101                     this.emit('change',this.get('value'));
     101                if ( this._onChangeActive &&
     102                     !(this.readOnly || this.disabled) ) {
     103                    if ( this._onChangeHandle ) {
     104                        this._onChangeHandle.cancel();
     105                    }
     106                    this._onChangeHandle = this.defer(function(){
     107                        this._onChangeHandle = null;
     108                        on.emit(this.domNode,'change',{
     109                            target: this.domNode,
     110                            value: this.get('value'),
     111                            bubbles: true,
     112                            cancellable: true
     113                        });
     114                    });
    102115                }
    103116                if ( evt ) { event.stop(evt); }
    104117                return false;
     118            } else {
     119                return evt;
    105120            }
    106             return true;
    107121        },
    108122        _handleSubmit: function(evt) {
Note: See TracChangeset for help on using the changeset viewer.