Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This one comes with a few caveats... #16

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

rlauck
Copy link
Contributor

@rlauck rlauck commented Nov 29, 2013

Changes:

  1. Ditched the id and with block - values cached in global scope
  2. Rewrite the table contents every blur
  3. Fixed: Plain strings in cells were throwing an exception

Cons:

  1. Because the table is rewritten onblur, tabbing no longer works and you have to click twice to edit another cell.
  2. Bad cell values or formulas will cause the table to fail to render until you manually clear the value from localStorage

Changes:
1. Ditched the id and with block - values cached in global scope
2. Rewrite the table contents every blur
3. Fixed: Plain strings in cells were throwing an exception

Cons:
1. Because the table is rewritten onblur, tabbing no longer works and you have to click twice to edit another cell.
2. Bad cell values or formulas will cause the table to fail to render until you manually clear the value from localStorage
@aemkei
Copy link
Owner

aemkei commented Nov 29, 2013

Nice rewrite and down to 281! Just had t call localStorage.clear() to make it work.

But in my opinion, it is too hard to use, because you can't just click another cell to edit.

https://rawgithub.com/rlauck/aemkei.github.io/c5b52604e71b0a8a96a8de823f712b332c884cb0/sheet/index.html

@p01 and @subzey: What do you think?

@p01
Copy link
Contributor

p01 commented Nov 29, 2013

Well done getting this to 281.

@aemkei: I tried the same approach and found that rewriting the table onblur made the spreadsheet way TOO hard to use. Thus I did not even commit, push, pull-request

@rlauck
Copy link
Contributor Author

rlauck commented Nov 29, 2013

I agree that this makes it hard to use, probably not a good idea to merge this in its current state.

I had an earlier version that was around 287 so I'll revert this pull request back to that when I have time later today. Thanks for taking a look guys

Changes:
1. Append 'i' to the input id so it can be referenced in addition to the calculated value for a cell in the global scope. This eliminates with(t) and shaves a few bytes.
2. replace(/^=?/,"=") is the smallest way I've found yet to normalize formulas before the eval. The string issue still exists however - fixing will add some bytes back...
3. rely on the first param of A() to denote the first iteration for building the table
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants