Changeset 12830

Show
Ignore:
Timestamp:
03/03/08 08:28:12 (10 months ago)
Author:
sorvell
Message:

!strict fixes #5032 To correct this problem, support was added to dojox.grid.data.Objects to allow for data structure changes. The issue here was specifically with automatic assignment of model fields. Fields are now auto-assigned when data is set and grid is notified that fields may have changed.

Location:
dojox/trunk/grid
Files:
2 added
1 modified

Legend:

Unmodified
Added
Removed
  • dojox/trunk/grid/_data/model.js

    r12739 r12830  
    257257                } 
    258258        }, 
     259        allChange: function(){ 
     260                this.notify("FieldsChange"); 
     261                this.inherited(arguments); 
     262        }, 
    259263        autoAssignFields: function(){ 
    260                 var d = this.data[0], i = 0; 
     264                var d = this.data[0], i = 0, field; 
    261265                for(var f in d){ 
    262                         this.fields.get(i++).key = f; 
    263                 } 
     266                        field = this.fields.get(i++); 
     267                        if (!dojo.isString(field.key)){ 
     268                                field.key = f; 
     269                        } 
     270                } 
     271        }, 
     272        setData: function(inData){ 
     273                this.data = (inData || []); 
     274                this.autoAssignFields(); 
     275                this.allChange(); 
    264276        }, 
    265277        getDatum: function(inRowIndex, inColIndex){