SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Javascript Spreadsheet

    I've taken a look around the net, and I've noticed some spreadsheet scripts out there written in javascript/html, and I've noticed they mostly seem to lack some functionality/formulas.

    So I've been playing around with creating my own spreadsheet, and so far I have something approximating a spreadsheet in Firefox.

    I have a couple of issues with making cross-browser, as I clearly do not understand the problems with the Opera and IE browsers.

    Current issues:

    1. IE apparently only recognizes every 2nd column/row when entering data, but will quite happily allow the user to scroll around the page with the mouse-wheel and the arrow keys.
    2. Every time the user switches cells, what is happening in the background is that the innerHTML of the cell is being recorded, then copied into a textfield for editting, which is then swapped for the old innerHTML. However in IE (and occasionally in Opera) what happens sometimes is that I get a double event firing or something weird like that, and I end up with an text field with its OWN innerHTML inside itself (gotta like that self-referencing stuff).
    3. Who knows what else is wrong with the formulas in IE since I can't get past issue #1.
    4. Opera apparently doesn't recognize the mouse-wheel event at all, and only fires the onkeydown event once (even if you hold down the key on your keyboard). Also, Opera also occasionally likes to swap the innerHTML for itself as with issue #2 above.

    You can view the spreadsheet here and read my blog enter about it here.

    If anyone could help me iron out these cross-browser issues, I would greatly appreciate it.

  2. #2
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I visited your spreadsheet, and I didn't really get what I was supposed to do to see it in "action"...

  3. #3
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Spreadsheet in Action

    Aaah...yes, no instructions on that page.

    You have to enter numerical values into the cells, and then you can use some formulas in other cells like:

    sum(A1:A4), mean(A1:A10), etc...

    and it will calculate the sum of cells A1 through A4 or the mean of cell A1 through A10, etc...

    You can see more complete instructions here. The eventual plan is to include more functionality of a regular spreadsheet (ie ability to save work, print work, etc...) but I need to solve these problems first (I assume if I can get it working properly in Opera, IE-Win, Firefox and Safari then I have virtually every user covered, sorry Konqueror users - I don't have an installation of Linux handy).

    Remember this is a work in progress. I am also looking for helping solving some of the cross-browser issues.

    Dave

  4. #4
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Doesn't work in IE nor Firefox, I can't enter any data.

  5. #5
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Entering data

    Weird...it was working fine this morning in Firefox 2.0, and mostly working in Opera. I will double check when I get home that I didn't make some strange error when I uploaded the JS.

    Dave

  6. #6
    SitePoint Wizard Pepejeria's Avatar
    Join Date
    Jan 2005
    Location
    Too far up north
    Posts
    1,566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, I clicked on it and nothing happens...

  7. #7
    SitePoint Zealot
    Join Date
    Jul 2006
    Posts
    151
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Problem fixed - sort of

    Yeah last minute I changed the code a bit so the onclick event was added to the page 50 milliseconds after page load rather than 500 milliseconds, and apparently, that's too short, so I've increased it back to 500 milliseconds, and now you can quite happily click on the cells and they switch into text fields.

    It's throwing some very strange error in Firefox 1.5.0.6 that I'm really not sure where it is coming from, however the error doesn't appear to prevent any of the functionality of the script...

    Code:
    [Exception... "'Permission denied to set property XULElement.selectedIndex' when calling method: [nsIAutoCompletePopup::selectedIndex]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "JS frame :: http://www.unitorganizer.com/spreadsheet/js/spreadsheet.js :: handleDelta :: line 89" data: no]
    Line 89 is where I set the focus of the screen to the cell that was just created. I suppose it's possible that this cell takes some time to add to the DOM, and so doesn't exist when I try to set focus?

    Dave


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •