Ignore:
Timestamp:
03/10/14 16:07:00 (11 years ago)
Author:
hendrikvanantwerpen
Message:
  • Indicate of refresh is due to load or due to save in _ObjectPage.
  • _ComplexValueMixin & ListWidget? catch all change events and drops them if still being created.
Location:
Dev/trunk/src/client/qed-client/widgets
Files:
2 edited

Legend:

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

    r494 r500  
    1414        name: "",
    1515        value: null,
     16        disabled: false,
     17        readOnly: false,
    1618        multiple: true,
    1719        type: "text",
     
    2022         */
    2123        container: Source,
     24        _onChangeActive: false,
    2225        buildRendering: function() {
    2326            this.inherited(arguments);
     
    5053            });
    5154            this.source = new this.container(this.domNode,sourceParams);
    52             this.own(this.source.on('Drop',lang.hitch(this,'_handleChange')));
     55            this.own(this.source.on('Drop',
     56                                    lang.hitch(this,'_handleDrop')));
     57            this.own(on(this.domNode,'change',
     58                        lang.hitch(this,'_handleChange')));
    5359        },
    5460        creator: function(item, hint) {
     
    9298            return this.value;
    9399        },
    94         _setValueAttr: function(value) {
     100        _setValueAttr: function(value,priorityChange) {
    95101            this.clear();
    96102            this.appendItems(value || []);
     
    158164            this.inherited(arguments);
    159165        },
    160         _handleChange: function() {
    161             this.value = this._getValueAttr();
    162             this.onChange(this.value);
     166        _handleChange: function(evt) {
     167            if ( evt.target !== this.domNode ) {
     168                if ( this._onChangeActive && !(this.readOnly || this.disabled) ) {
     169                    this.emit('change',this.get('value'));
     170                }
     171                if ( evt ) { event.stop(evt); }
     172                return false;
     173            }
     174            return true;
    163175        },
    164         onChange: function(value) {}
     176        _handleDrop: function() {
     177            if ( this._onChangeActive && !(this.readOnly || this.disabled) ) {
     178                this.emit('change',this.get('value'));
     179            }
     180        }
    165181    });
    166182});
  • Dev/trunk/src/client/qed-client/widgets/_ComplexValueMixin.js

    r493 r500  
    1111    return declare([_Container, _FormMixin], {
    1212        name: "",
     13        value: null,
    1314        disabled: false,
    1415        readOnly: false,
    15         _changeActive: false,
     16        _onChangeActive: false,
     17        constructor: function() {
     18            this._listenerMap = {};
     19        },
     20        buildRendering: function() {
     21            // capture child change events
     22            this.inherited(arguments);
     23            this.own(on(this.domNode,'change',
     24                        lang.hitch(this,'_handleChange')));
     25        },
     26        create: function() {
     27            this.inherited(arguments);
     28            this._onChangeActive = true;
     29        },
    1630        postCreate: function() {
    1731            this.inherited(arguments);
     
    2438            if (this._started) { return; }
    2539            this.inherited(arguments);
    26             this._connectChildren();
    27             this._changeActive = true;
    28         },
    29         _connectChildren: function() {
    30             var children = this._getDescendantFormWidgets();
    31             array.forEach(children, lang.hitch(this,function(child) {
    32                 this.own(child.on('change',lang.hitch(this,'_handleChange')));
    33             }));
    3440        },
    3541        _setDisabledAttr: function(value) {
     
    4147        // Yuk, this function is taken directly from _FromMixin only
    4248        // to add the priorityChange parameter
     49        _getValueAttr: function() {
     50            this.value = this.inherited(arguments);
     51            return this.value;
     52        },
    4353                _setValueAttr: function(obj, priorityChange) {
     54            this.value = obj;
     55
    4456                        var map = { };
    4557                        array.forEach(this._getDescendantFormWidgets(), function(widget){
     
    8496            }
    8597        },
    86         _handleChange: function() {
    87             if ( this._changeActive ) {
    88                 this.onChange(this.get('value'));
     98        _handleChange: function(evt) {
     99            if ( evt.target !== this.domNode ) {
     100                if ( this._onChangeActive && !(this.readOnly || this.disabled) ) {
     101                    this.emit('change',this.get('value'));
     102                }
     103                if ( evt ) { event.stop(evt); }
     104                return false;
    89105            }
     106            return true;
    90107        },
    91         onChange: function(){},
    92108        _handleSubmit: function(evt) {
    93109            var node = this.domNode;
Note: See TracChangeset for help on using the changeset viewer.