i am about finish my integration work with backbone and webix. however i have a problem:
my model’s id is overwritten with a cid.
i.e my model has e.g. id=1234 originally and after integration it becomes like id=c50
that way i am losing my id and the software doesn’t work as intended.
how can i suppress this behavior and not lose my id value?
a) it uses cid from collection as id in the webix API
b) it uses the id of object as id in the webix API
Default mode is (a), but you can use mode (b) by using
some.sync(collection, { use_id: true });
Still, the id of records in the synced backbone collection must not be corrupted. Webix components makes copy of all data, to preserve original collection intact, and during data saving “id” attribute is not saved back in the original collection.
Please confirm that you have corruption of id in the original model, not the id which was obtained by webix API. I will double-check code in such case.
Mode (a) is default, because in other case webix components will need to set “id” attribute for the new records, and it will break data saving through backbone ( backbone expects null id for the new records ).
I have double checked the code and still don’t see how events from the webix views can corrupt attributes of collection. Check the next sample http://webix.com/snippet/b869fdd8
You can edit data in grid, and record will be updated in the collection, but id will stay not changed.