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

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

Expression Widget - Almost all the power of client side javascript - in a Tiny Tiny Widget

PaiChung
22-Sapphire I

Expression Widget - Almost all the power of client side javascript - in a Tiny Tiny Widget

Recently I was reminded again that we have an Expression Widget

The Expression Widget does client side execution of JavaScript.

Not all objects are enabled on it, but you can do some really powerful things with it.

2 Examples

1. Client side conversion of units - By doing this you can save on resources and load on the Server, imagine thousands of users accessing data that needs to be converted server side before sending it over to the Client. - Thanks Costin Badici for this approach.

2. Refresh your whole Mashup to have your new language tokens loaded. What if you want to have users be able to change their language preference on the fly? For the new language tokens to load, a full mashup/window refresh is needed. You can simply use location.reload() in the Expression Widget

Got more Client side code tips? Add them in the comments!

1 REPLY 1

Well, would be good to have a better input method for Expression widget, as when you do complex Javascript operations it's cumbersome...

For instance I do language translations on the fly with expressions widget:

TW.Runtime.convertLocalizableString( '[[tokenName]]')

Announcements


Top Tags