webismymind/editablegrid — pull request #19 by csolar (2012-05-07 16:30:21+00:00)
Title: Appending rows to empty tables

Fixed adding row to an empty table:

when append() is called on an empty table, it invokes insertAfter() passing rowIndex=(data.length-1)=-1.
This triggers a call to insert() with rowIndex = 0.

At this point however (rowIndex = data.length) which would trigger a call to insertAfter() with rowIndex=-1 again!

Thus we get stuck in an infinite mutual call between insertAfter() and insert().

I have added a check to make sure we only make a second call to insertAfter if data.length > 0.