Changeset 1913


Ignore:
Timestamp:
2011-07-20 14:58:20 (10 months ago)
Author:
jgou
Message:

clone values and labels from options before setting them to avoid that - in case the control is nullable - multiple null options are prepended when the set function is called more than once ; this fixes #464

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/modules/kauri-forms/kauri-forms-framework/src/main/kauri/static-{build}.key/kauri.forms/field.js

    r1820 r1913  
    159159    */ 
    160160    Options.prototype.set = function( values, labels) { 
    161          
    162         this.values = values; 
     161        values = $.extend([], values); //clone to avoid issue #464 
     162        labels = labels ? $.extend([], labels) : null;  
    163163        if (this.type) { 
    164164            this.userValues = new Array(); 
     
    180180            for (var i = values.length; i>0; i--) { 
    181181                values[i] = values[i-1]; 
    182                 labels[i] = labels[i-1]; 
     182                labels[i] = labels[i-1];  
    183183                this.userValues[i] = this.userValues[i-1]; 
    184184            } 
     
    188188        } 
    189189 
    190         this.labels = labels; 
    191          
     190        this.values = values; 
     191        this.labels = labels;         
    192192         
    193193        this.update(); 
Note: See TracChangeset for help on using the changeset viewer.