#5405 closed defect (fixed)
dojox.grid.editors.Select could't set the values with 0(zero) or ""(blank string)
Reported by: | guest | Owned by: | sorvell |
---|---|---|---|
Priority: | high | Milestone: | 1.1 |
Component: | DojoX Grid | Version: | 1.0 |
Keywords: | Cc: | ||
Blocked By: | Blocking: |
Description
When set the editor to dojox.grid.editors.Select and set the values of the Select with zero, like this:
gridLayout = [ { cells: [ //subrow1 [ { name: 'name', width:'12em' }, { name: 'Status', editor: dojox.grid.editors.Select, options: ["new", "read","replied"], values: [0,1,2]//here,the zero } ] ] } ];
When you double-click the cell,the Select will not have any options.Since I found the problem at the line 191,dojox/grid/_data/editors.js:
for (var i=0, o, v; (o=this.options[i])&&(v=this.values[i]); i++){ h.push("<option", (inDatum==o ? ' selected' : ''), /*' value="' + v + '"',*/ ">", o, "</option>"); }
Since the zero was converted to false implicitly.
Change History (3)
comment:1 Changed 13 years ago by
Milestone: | → 1.1 |
---|
comment:2 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:3 Changed 13 years ago by
tests/test_edit.html includes a working example similar to the one described in this bug. For brevity, here is the relevant bit:
{ name: 'Priority', styles: 'text-align: center;', editor: dojox.grid.editors.Select, options: ["normal", "note", "important"], values: [0, 1, 2], formatter: function(inDatum) { return this.options[inDatum]} }
The expectation here is that the data values for this column will be 0, 1, or 2. The cell is formatted to show the option, the editor shows the options, but the data stores the value.
The use of values is completely optional. If they are unspecified, values will be created that are the same as the options.
(In [12847]) !strict fixes #5405 dojox.grid.editors.Select now accepts 0 as a value property. Previously, the the values property was not properly used. This has also been repaired.