Opened 15 years ago

Closed 14 years ago

Last modified 14 years ago

#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:


When set the editor to dojox.grid.editors.Select and set the values of the Select with zero, like this:

gridLayout = [
	        cells: [
	                    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 14 years ago by dylan

Milestone: 1.1

comment:2 Changed 14 years ago by sorvell

Resolution: fixed
Status: newclosed

(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.

comment:3 Changed 14 years ago by sorvell

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.

Note: See TracTickets for help on using tickets.