cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Learn all about PTC Community Badges. Engage with PTC and see how many you can earn! X

Session and Local storage

jensc
17-Peridot

Session and Local storage

Hello all,

 

I got a question from a colleague on how they can automatically select a node in a tree widget after refreshing their 9.3 mashup. 

I recommended that they use the "localStorage" object in an expression, as I had used it before (in 9.1).

 

But it seems like after the update from "Type" : "expression" to "Type" : "expression2" (the security update) this is no longer working.

 

We also saw that the sessionStorage object has been depricated in this PTC help center article

 

I just wanted to clarify what our options are.

 

This PTC help center article talks about session parameters, but that they only last during the session and that the recommended way for session breaking parameters is to store this type of information in a database or on a thing.

 

Is this the proper way going forward?

 

Thanks,

Jens

1 ACCEPTED SOLUTION

Accepted Solutions
DanZ
15-Moonstone
(To:jensc)

If creating an extension that can read/write the browser storage is not feasible for you, I would store such "meta"-information as a persistent property in a UI-controller thing. In your specific case I would create an infotable (or maybe JSON) property that contains a row for each user and their respective selection in the tree widget.

Of course this solution has its downsides. When a user is deleted you need to remove his selection entry in this infotable. Furthermore, depending on your user count and the usage of the widget in the UI, this can put heavy load on your database.

 

I would prefer the session parameters if the users are accepting it.

View solution in original post

1 REPLY 1
DanZ
15-Moonstone
(To:jensc)

If creating an extension that can read/write the browser storage is not feasible for you, I would store such "meta"-information as a persistent property in a UI-controller thing. In your specific case I would create an infotable (or maybe JSON) property that contains a row for each user and their respective selection in the tree widget.

Of course this solution has its downsides. When a user is deleted you need to remove his selection entry in this infotable. Furthermore, depending on your user count and the usage of the widget in the UI, this can put heavy load on your database.

 

I would prefer the session parameters if the users are accepting it.

Top Tags