Added example of a simple row insertion, as it took me a little while to figure it out (but perhaps I'm just slow :smile: )
Added function ensureIdAndThatItDoesNotExistto slick.dataview.js, and call it whenever we add a new row. Without this function, many rows will be assigned to the same key in the idxById map (so they will overwrite each other), and idxById will only contain the idx of the most recently added row with that id. This screws other things up; e.g., upon a call to deleteItem, only the most recently added row with this id will be deleted. Better to fail loudly the first time a duplicate id is added, I believe.
A few changes:
ensureIdAndThatItDoesNotExist
toslick.dataview.js
, and call it whenever we add a new row. Without this function, many rows will be assigned to the same key in theidxById
map (so they will overwrite each other), andidxById
will only contain the idx of the most recently added row with thatid
. This screws other things up; e.g., upon a call todeleteItem
, only the most recently added row with thisid
will be deleted. Better to fail loudly the first time a duplicateid
is added, I believe.