I’m implementing a javascript client side API which connects to REST and retrieves a the results of an SQL query in the form of a xml/json.
I would like to load this information into a structure that would allow me to manipulate the data easily from the javascript bit, i.e. sort the information based on a column name, lookups, etc…
I noticed many solutions for the above that are based on an HTML table being generated/manipulated, however I don’t want to draw the table in anyway, just be able to query it locally.
It needs to serve as a structured local data store.
Do it like how frameworks and NoSQL databases do it – document-based databases. It’s basically using arrays and object literals as a storage medium in your page. when you need to persist it, use
JSON.stringify()to turn it into a string and store in the localstorage and parse it later withJSON.parse()as for manipulations like sorting and ordering the data, you can craft your own, or use other frameworks which already have functions to do this work.
i would suggest looking into BackboneJS and how it handles it’s model and collection. also, you might want to take a look at MongoDB also, and it’s NoSQL, JSON-format database.