Wednesday, April 14, 2010

Nitobi Excel Grid beaks in FireFox 3.6

Nitobi provides a JavaScript toolkit for a number of Web 2.0 solutions. One of them is a table Grid that supports "cut & paste" from Microsoft Excel sheet.
Basically, you can populate the table value by "cut & paste" from an excel sheet. It is a very useful feature, if you have a web form that needs to be filled in with data from an excel sheet.

Unfortunately, the functionality doesn't work in Firefox 3.6. The bad boy here is the proprietary API "document.getBoxObjectFor" provided by Firefox. This is not a standard API approved by industry and is available only in Firefox.
Firefox decided to scrap this API since version 3.6. The replaced API is "getBoundingClientRect", that is industry standard and is available in IE and Firefox previous versions as well.

Fixing the Issue
To fix the issue, replace the "document.getBoxObjectFor" with "getBoundingClientRect" carefully. It is not a straight forward replacement. The following code can help explaining how to do this replacement.

Old API:
var x = document.getBoxObjectFor(elem);//where elem is a sample DOM element

New API
var x = elem.getBoundingClientRect()

njoy
Sajith