Using Client Context Data in a component
Hi there
1) I was following the AEM6 clinet_context_in_detail documentation and was able to create - http://docs.adobe.com/docs/en/aem/6-0/develop/personalization/client-context.html and was able to develop the example geoloc component "Example: Creating a Custom Context Store Component" in the aforesaid link
2) I could edit the client context and place the Location Store as explained in the example
Now, what I want to achieve is to read the data in the client context for the aforesaid store that was created. For that, I was putting following JS code in my component JSP
<script type="text/javascript">
alert('City ; ' + getName());
function getName(){ var store = CQ_Analytics.ClientContextMgr.getRegisteredStore("locstore"); if(store){ return store.getProperty("city", false); } else { return null; }}</script>
<!-- once I get the city value, then will put the divs to construct the rendering of the component -->
With this code, I get the store object as null (printed in console.log). However, this works for the OOB store "surferinfo" as I am able to get output for the property as OS or browser etc..
Any clue why the custom store does not work...
Appreciate the help.