// typically will you have a json structure as a response from a gj.ajax
// we start up the store.
gj.store.setData({
'customerdata' : respons
});
// update the whole store
// mark the second parameter. This is optional. But if it is there the store will parse this are of the DOM and update the elements
// connected to the store (see exampel next page)
gj.store.updateData({
'customerdata' : newRespons
}, $('#myAppDOMid'));
// update a known key in the store
// your will get an error if you try to update a key that do not exist
// DOM element connected to this store key will also be updated
gj.store.set('customerdata.firstname', 'Donald');
// get all the data in store
var flag = true ; // set this to true of if you want to clear 'changetracker' in store
var storeData = gj.store.getData(flag);
// return true if something has been changed in store since store was started OR getData with flag = true was executed
var status = gj.store.hasDataChanged(/*optinal put a key in here and get the status only on this key*/);
//This will just display the changes to the store. A debug function
gj.store.showStoreChanges()
//get a spesific value
var myVal = gj.store.get('customerdata.firstname');
//callbackfunction if a spesific key get changed
gj.store.watch('customerdata.firstname',function(newValue,oldValue,key){
console.error('firstname changed from ' + oldValue + ' to ' + newValue);
});