I\'m looking for an approach or a library that handles this. the idea is to store data in localstorage and sync to the backend when a connection is available, http://pouchdb.com
you can also take a look at jaydata
http://jaydata.org/blog/synchronized-online-offline-data-applications-part-2-syncing-large-tables-and-tables-with-foreign-relations