Update Model "get more" with JS

Hi,

While writing a snippet where I have to query a model with loads of records in it (800+) I felt the urge to use model.sync() instead of model.updateData() because of the load time. As far as I can tell model.sync() is basically the “get more” version of the multiple actions. 

I know model.sync() is a prototype method and not documented by any means.
Although there is a bug in it and I really would like to have it as an official function :slight_smile:

Concerning the bug:
When using the regular updateData() function the sort-order of the model gets applied but not when using model.sync(). Instead of appending the data it prepends all the newly queried data (I sorted by CreatedDate).
To be extra sure I queried the model using the action framework and the option “get more”, which worked correctly (it appended the new data as it should).

I stumbled across this little issue while reading/importing data from IOT-Devices once every minute and then live-updating charts (which are categorized by CreatedDate. I wouldn’t have noticed it otherwise).

For now I implemented the workaround using multiple actions to “get more” data but I hope that the model.sync() will soon be an official function :slight_smile:

Cheers

model.getMoreData() is the “get more” version. Use that instead. model.sync() is not supported yet.

Cool, thanks Zach!