webismymind / editablegrid

EditableGrid is an open source Javascript library aimed at turning HTML tables into advanced editable components. It focuses on simplicity: only a few lines of code are required to get your first table up and running.
http://www.editablegrid.net
Other
796 stars 271 forks source link

How to Append #69

Closed abethcrane closed 8 years ago

abethcrane commented 10 years ago

I can't find an example of appending, and the documentation isn't clear - http://www.editablegrid.net/documentation/symbols/EditableGrid.html#append - the arguments are listed as rowId, columns (as an integer?), dontSort, dontSort (twice?).

I keep getting errors like "ReferenceError: attrName is not defined" or "TypeError: Cannot read property 'visible' of undefined"

I'm trying things like: editableGrid.append(3, {"Author": "ME", "Title": "Your Mum"}, {}, true); So rowId: 3, some column info, no attributes and dontSort set to true.

webMac commented 9 years ago

Hm, try something like:

  editableGrid.append(editableGrid.data.length, { 'Author': 'ME' }, true);

Maybe also the addRow() function applies for this purpose. I'm not quiet sure on this one yet..

jakepens71 commented 9 years ago

Just to clarify, if no one has tried this yet, webMac has the correct answer.

editableGrid.append(editableGrid.data.length, { 'Author': 'ME' }, true);

This successfully created a new that was able to be edited for all my columns.

adesakin commented 7 years ago

editableGrid.append(editableGrid.data.length+1, { 'Author': 'ME' }, true);

You need to skip to next row by adding +1 to the data length.