Saturday, August 16, 2014

Adding tables to Etherpad Lite

So I love the real-time sharing of Google Docs, so I installed our own Etherpad Lite... and then I wanted tables so I installed ep_tables, but it was a bear to try and copy existing tables into there, so I finally exported some tables and found the format and here's what I recommend, in this example of 2 lines:

{"payload":[["This is a sample row on table 1"," "," "]],"tblId":"1","tblClass":"data-tables"}

{"payload":[[" "," "," row 2 column 3"]],"tblId":"1","tblClass":"data-tables"}

... where each row of data is a line of text.  Just paste them in the document and it reformats into a table.
It turns out the plugin doesn't like line breaks (or tabs) in a row, so don't even try... and that's one reason I wouldn't try and put multiple rows inside one payload line like this:
{"payload":[["This is a sample row on table 1","",""],["",""," row 2 column 3"]],"tblId":"1","tblClass":"data-tables"}

Since you can't split each row onto a new line it is pretty unreadable.
Other hints:

  • Only use the 'Table' button at the top to manipulate the table and not the little mouse-overs... they just never did anything reliable for me.
  • I also installed styles and formatting, but I couldn't get them to apply inside the table.
  • I don't see the purpose of the tblId; I put rows with the same tblId in different places and they showed at their location in the document, with line breaks or whatever in between.