Bugreport - ui.datatable.parse doesn't work as expected when pos equals to 0

Documentation states that “If you want to parse data in addition to the existing dataset, specify position of parsing, namely the index from which you insert new data:”

$$(“datatable”).parse({
pos: indexToStart,
data:dataset
});

If indexToStart equals to any number greater then zero and less then $$(“datatable”).count() - everything works as expected, old rows get updated according to parsed data. But if indexToStart = 0, then a new row is added, instead of an old one being updated. I suspect that there is a line like

if(params.pos)
//update records;
else
//insertRecods;

and it fails in situations where 0 is cast to false.

can’t delete comment, so just ignore this one

I’m running into the same issue. I’ve trying to start parsing at index 0, but it’s not working. Having you figured this out?

The point is that thepos inparse() has no possibility to add the data to the 0-position. It’s not a bug, but a feature due to the data processing.

If you need to add a single entry to the top, please use theadd method:

datatable.add({ id:'some', value:'some' }, 0)

The same method can be used for adding an array of data, but with one important thing: as theadd triggers the rendering each added item, you need to use the (un)blockEvent API to avoid multiple repainting:

http://webix.com/snippet/6e5f0d2e