Our blazing fast Grid component built with pure JavaScript


Post by proteams-kaan »

Hi,

While using the ajaxstore, for newly added items the store sets a string based phantomId but into the id field itself.

If we set the id field before the object is added to null, it causes an unhandled promise rejection after the response from the server is received.

Setting the ids to -1 seem to work without any issues.

I have two related questions:
1) Is it possible to disable phantomId generation or set it in a different field like we can in Schedule's crud manager?
2) If we cannot do anything in (1) or if they're not planned is it ok initialising ids to -1? Will we have any consequences down the road?

Br,
Kaan.

Post by pmiklashevich »

Hello Kaan,

Could you please describe the use case you have?

Phantom IDs have to be unique. And while they are new and unsynced to the server, they have some kind of made up id. The response from the server sends back the real id of the new database row, and it gets updated.

Regards,
Pavel

Pavlo Miklashevych
Sr. Frontend Developer


Post by proteams-kaan »

Hi Pavel,

My use case is that in typed languages on the server, it's quite inconvenient to have an id field that is both a string and then an integer (auto incremented id on the db side).

My other points would be that this is readily available in the scheduler component and also the mapping you mention is unstable and I'm guessing it expects the added items to be returned in the same order as there's no other way to detect which phantomId maps to the replaced id since you're loosing information by not having the phantomId in a separate field like we are able to do with Schedule component's crud manager.

Post Reply