Struggling with Data Storage

I am struggling with Data Storage and have been following Creating a Shopping Cart with the Data Store Component very closely.

My situation is different but yet very similar.

In it’s basic form I have an Input Radio Group with three radio buttons. I am trying to store the ID/name/value of the checked button in Local Storage, and then display that Local Storage info on the same web page.

My pages are SPA.

Should the on-click event be on the label or input?
My on-click event looks like
dmx-on:click="specialist_data.upsert({id: specialist_id},{name: specialist_name, value: specialist_cost, id: specialist_id})"

My values on the page display as
<p>name :: {{specialist_data.data[0].name}}</p>
<p>value :: {{specialist_data.data[0].value}}</p>
but nothing is showing

I don’t know what I am doing wrong, please help.

Also, how can I use DevTools to view the local storage and to see what is passed between the radio button and the local storage?

Can help with this bit… Select Application (next to Console in your Chrome Dev-Tools panel)… Click on Local Storage. Should see all you need there.

1 Like

I am still struggling, can anyone help?

I am getting a DevTools warning…
BaseComponent.js:276 Unknown component found! datastore
Is this my problem?
If yes, then how do I resolve this?
I have already upgraded to v.2.6.0

I’d highly recommend uploading all DMX prefixed directories (delete old directories first or rename dmxetcetcBACKUP). Clearing any cache client (browser) and server sides (NGINX, CloudFlare etc). Close your browser and reload the website. Works for me 99.9% of the time Riggers…

1 Like

Ah, I should have also mentioned that these issues are on my Dev machine, not production.

I have done the usual cleared the cache, restarts etc.

you have to use the datastore component on each page that will be accessing it? Maybe it wasn’t loaded on that page?

1 Like

Hi Baub, I’m only playing with it on one page and have the datastore component on that page. I will keep trying.

its not loaded before the javascript component?

I think you are onto something. I have just realised that the
<script src="../dmxAppConnect/dmxDatastore/dmxDatastore.js" defer=""></script>
script link was inserted onto the master/parent page of the SPA page (I didn’t notice) but that page was not saved.

I have now saved it and the warning no longer shows. It hasn’t resolved my overall issue but may well get me back on track. Cheers.

Success!
I am now passing data, editing data etc.
Thanks for your help guys.

2 Likes