Opened 12 years ago

Closed 11 years ago

#5430 closed defect (invalid)

Dojo Grid addRow generates editCell bug

Reported by: guest Owned by: sorvell
Priority: high Milestone: 1.2
Component: DojoX Grid Version: 1.0
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by Bryan Forbes)

Dojo version: 1.0, but the same code exists in the current 1.02

Browsers: IE6, FF 2.0

Error message: "Can't move focus to the control because it is invisible, not enabled, or of a type that does not accept the focus."

Contact email: pservedio@…

I've just built a 6 page wizard that heavily uses the new Dojo Grid with various editors. When I try to add a row to the tables (programmtically through the grid.addRow method()), I'm getting a bug in both browsers, but IE is much more serious. FF seems to eat the exception gracefully, but IE hangs.

Using dojo uncompressed and the MS script debugger, I stumbled upon this little gem in Grid.js:

		// begin editing row
		//FIXME: add to edit
		for(var j=0, c; ((c=this.getCell(j)) && !c.editor); j++){}
		if(c&&c.editor){
			<b>this.edit.setEditCell(c, i);</b>
		}

IE seems to hang at the setEditCell() call, and that FIXME statement is perhaps a sign?

It is actually failing in dojox._grid.edit.start(...) and generates the error message as stated above.

Upon further thought, the code snippet doesn't make sense at all...why would one assume that the first editor based cell encountered in a newly added row should be placed into edit mode? I commented out all the code above and now addRow() works fine...


Here are the details of my code:

<b>var myView = {
	cells: [[
	    ...
        {name: 'Adjusted Start Price', width: "150px", headerStyles: 'font-weight: bold; font-size: 11px;text-align: center;', styles: 'font-family: Arial, Helvetica, sans-serif; font-size: 11px; text-align: right;', editor: dojox.grid.editors.Dijit, editorClass: 'dijit.form.CurrencyTextBox', formatter: formatMoney},
    ...

function formatMoney(inDatum) {
		return isNaN(inDatum) ? '' : wiz3currencySym + ' '+parseFloat(inDatum).toFixed(0);
}

Here is how I'm adding the row, the variable's contents look fine (rawPrice, for example, maps to the currencyTextBox and is stringified number).

    <b>// Add the row to the table
    var rowArray = new Array(' ', desc, qty, formatPrice, oh, rawPrice, newID, fileType);

    var pptTable = dijit.byId('wiz3PerPatTable');
    
    pptTable.addRow(rowArray, pptTable.model.count);    
</b>
</quote>

Change History (4)

comment:1 Changed 12 years ago by Adam Peller

Component: DojoxDojoX Grid
Description: modified (diff)
Owner: changed from Adam Peller to sorvell

comment:3 Changed 12 years ago by dylan

Milestone: 1.2
Priority: highnormal

comment:4 Changed 11 years ago by Bryan Forbes

Description: modified (diff)
Resolution: invalid
Status: newclosed

addRow doesn't modify the store anymore. Marking invalid.

Note: See TracTickets for help on using tickets.